#include<bits/stdc++.h>
#define int64_t uint64_t
#define int uint64_t
#define ld double
using namespace std;
const int logn = 19;
typedef complex<double> ftype;
const int maxn = 1 << logn;
int shift = 13;
int mask = (1 << shift) - 1;
ftype w[maxn];
const double pi = acos(-1);
template<typename T>
inline void fft(T *in, ftype *out, int n, int k = 1) {
if(n == 1) {
*out = *in;
return;
}
n /= 2;
fft(in, out, n, 2 * k);
fft(in + k, out + n, n, 2 * k);
for(int i = 0; i < n; i++) {
ftype t = w[n + i] * out[i + n];
out[i + n] = out[i] - t;
out[i] += t;
}
}
vector<int> mul(vector<int> a, vector<int> b) {
int n = a.size() + b.size() - 1;
while(__builtin_popcount(n) != 1) {
n++;
}
a.resize(n);
b.resize(n);
ftype A0[maxn], A1[maxn];
ftype B0[maxn], B1[maxn];
for(int i = 0; i < n; i++) {
A0[i] = {a[i] & mask, (a[i] >> shift) & mask};
A1[i] = {(a[i] >> 2 * shift) & mask, (a[i] >> 3 * shift) & mask};
B0[i] = {b[i] & mask, (b[i] >> shift) & mask};
B1[i] = {(b[i] >> 2 * shift) & mask, (b[i] >> 3 * shift) & mask};
}
ftype P0[maxn], P1[maxn], Q0[maxn], Q1[maxn];
fft(A0, P0, n); fft(A1, P1, n);
fft(B0, Q0, n); fft(B1, Q1, n);
for(int i = 0; i < n; i++) {
ftype a0 = (P0[i] + conj(P0[(n - i) % n])) / ftype(2, 0);
ftype a1 = (P0[i] - conj(P0[(n - i) % n])) / ftype(0, 2);
ftype a2 = (P1[i] + conj(P1[(n - i) % n])) / ftype(2, 0);
ftype a3 = (P1[i] - conj(P1[(n - i) % n])) / ftype(0, 2);
ftype b0 = (Q0[i] + conj(Q0[(n - i) % n])) / ftype(2, 0);
ftype b1 = (Q0[i] - conj(Q0[(n - i) % n])) / ftype(0, 2);
ftype b2 = (Q1[i] + conj(Q1[(n - i) % n])) / ftype(2, 0);
ftype b3 = (Q1[i] - conj(Q1[(n - i) % n])) / ftype(0, 2);
A0[i] = (a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0) + ftype(0, 1) * (a0 * b0);
A1[i] = (a0 * b2 + a1 * b1 + a2 * b0) + ftype(0, 1) * (a0 * b1 + a1 * b0);
}
fft(A0, P0, n); fft(A1, P1, n);
reverse(P0 + 1, P0 + n);
reverse(P1 + 1, P1 + n);
for(int i = 0; i < n; i++) {
int A = llround((ld)imag(P0[i]) / n), B = llround((ld)imag(P1[i]) / n);
int C = llround((ld)real(P1[i]) / n), D = llround((ld)real(P0[i]) / n);
a[i] = A + (B << shift) + (C << 2 * shift) + (D << 3 * shift);
}
return a;
}
int pw = 1ULL << 63;
int bpow(int x, int n) {
return n ? n % 2 ? x * bpow(x, n - 1) : bpow(x * x, n / 2) : 1;
}
signed main() {
//freopen("input.txt", "r", stdin);
for(int i = 0; i < logn; i++) {
int cur = 1 << i;
for(int j = 0; j < cur; j++) {
w[cur + j] = polar((ld)1, pi * j / cur);
}
}
int n;
cin >> n;
int fact[n + 1], rfact[n + 1];
int rem[n + 1];
fact[0] = 1;
rfact[0] = 1;
rem[0] = 0;
for(int i = 1; i <= n; i++) {
int t = i;
rem[i] = rem[i - 1];
while(t % 2 == 0) {
t /= 2;
rem[i]++;
}
fact[i] = fact[i - 1] * t;
rfact[i] = bpow(fact[i], pw - 1);
}
vector<int> in1(n + 1), in2(n + 1);
for(int i = 0; i <= n; i++) {
cin >> in1[i];
in1[i] *= rfact[i];
in1[i] <<= i - rem[i];
}
for(int i = 0; i <= n; i++) {
cin >> in2[i];
in2[i] *= rfact[i];
in2[i] <<= i - rem[i];
}
vector<int> res = mul(in1, in2);
for(int i = 0; i <= n; ++i) {
int div_by = i - rem[i];
res[i] = (res[i] >> div_by) * fact[i];
cout << uint32_t(res[i]) << ' ';
}
cout << '\n';
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCiNkZWZpbmUgaW50NjRfdCB1aW50NjRfdAojZGVmaW5lIGludCB1aW50NjRfdAojZGVmaW5lIGxkIGRvdWJsZQoKdXNpbmc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SA9IDA7IGkgPCBsb2duOyBpKyspIHsKICAgICAgICBpbnQgY3VyID0gMSA8PCBpOwogICAgICAgIGZvcihpbnQgaiA9IDA7IGogPCBjdXI7IGorKykgewogICAgICAgICAgICB3W2N1ciArIGpdID0gcG9sYXIoKGxkKTEsIHBpICogaiAvIGN1cik7CiAgICAgICAgfQogICAgfQogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIGludCBmYWN0W24gKyAxXSwgcmZhY3RbbiArIDFdOwogICAgaW50IHJlbVtuICsgMV07CiAgICBmYWN0WzBdID0gMTsKICAgIHJmYWN0WzBdID0gMTsKICAgIHJlbVswXSA9IDA7CiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47IGkrKykgewogICAgICAgIGludCB0ID0gaTsKICAgICAgICByZW1baV0gPSByZW1baSAtIDFdOwogICAgICAgIHdoaWxlKHQgJSAyID09IDApIHsKICAgICAgICAgICAgdCAvPSAyOwogICAgICAgICAgICByZW1baV0rKzsKICAgICAgICB9CiAgICAgICAgZmFjdFtpXSA9IGZhY3RbaSAtIDFdICogdDsKICAgICAgICByZmFjdFtpXSA9IGJwb3coZmFjdFtpXSwgcHcgLSAxKTsKICAgIH0KICAgIHZlY3RvcjxpbnQ+IGluMShuICsgMSksIGluMihuICsgMSk7CiAgICBmb3IoaW50IGkgPSAwOyBpIDw9IG47IGkrKykgewogICAgICAgIGNpbiA+PiBpbjFbaV07CiAgICAgICAgaW4xW2ldICo9IHJmYWN0W2ldOwogICAgICAgIGluMVtpXSA8PD0gaSAtIHJlbVtpXTsKICAgIH0KICAgIGZvcihpbnQgaSA9IDA7IGkgPD0gbjsgaSsrKSB7CiAgICAgICAgY2luID4+IGluMltpXTsKICAgICAgICBpbjJbaV0gKj0gcmZhY3RbaV07CiAgICAgICAgaW4yW2ldIDw8PSBpIC0gcmVtW2ldOwogICAgfQogICAgdmVjdG9yPGludD4gcmVzID0gbXVsKGluMSwgaW4yKTsKICAgIGZvcihpbnQgaSA9IDA7IGkgPD0gbjsgKytpKSB7CiAgICAgICAgaW50IGRpdl9ieSA9IGkgLSByZW1baV07CiAgICAgICAgcmVzW2ldID0gKHJlc1tpXSA+PiBkaXZfYnkpICogZmFjdFtpXTsKICAgICAgICBjb3V0IDw8IHVpbnQzMl90KHJlc1tpXSkgPDwgJyAnOwogICAgfQogICAgY291dCA8PCAnXG4nOwogICAgcmV0dXJuIDA7Cn0K