intget(){ char ch; int v,f=0; while (!isdigit(ch=getchar())) if (ch=='-') break; if (ch=='-') f=1;else v=ch-48; while (isdigit(ch=getchar())) v=v*10+ch-48; return f?-v:v; }
constint maxn = 100020; typedeflonglong ll; ll a[maxn], b[maxn]; ll am[3],ans[3]; int n; intmain(){ ios::sync_with_stdio(false); cin.tie(0); cin >> n; for (int i = 0; i < n; i++) cin >> a[i], am[i%3] += a[i]; for (int i = 0; i < n; i++) cin >> b[i]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) ans[j] += b[i] * (am[((ll)j-(ll)i*n-2+3*(ll)maxn*maxn)%3]); } cout << ans[0] <<" " << ans[1] << " " << ans[2] << endl; return0; }