#include <bits/stdc++.h>   using namespace std;   long long n, len, lcm, g, mod;   long long a[266666], b[266666], c[266666], d[266666], e[266666], f[266666];   long long pw[266666], tmp[266666], w[2][266666], rev[266666];   long long mul(long long a, long long b) {     return (a * b - (long long)(((long double)a * b + 0.5) / mod) * mod + mod) %            mod;   }   long long qp(long long a, long long b) {     long long c = 1;     for (; b; b >>= 1, a = mul(a, a))       if (b & 1) c = mul(c, a);     return c;   }   long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }   void init() {     for (len = 1; len <= 2 * n; len <<= 1)       ;     lcm = len / gcd(len, n) * n;     mod = lcm + 1;     while (mod < 5000000) mod += lcm;     for (;; mod += lcm) {       long long flag = 0;       for (long long i = 2; i * i <= mod; i++)         if (mod % i == 0) {           flag = 1;           break;         }       if (!flag) break;     }     for (g = 3;; g++) {       long long flag = 0;       for (long long i = 2; i * i <= mod - 1; i++)         if ((mod - 1) % i == 0) {           if (qp(g, i) == 1) {             flag = 1;             break;           }           if (qp(g, (mod - 1) / i) == 1) {             flag = 1;             break;           }         }       if (!flag) break;     }     long long dan = qp(g, (mod - 1) / n);     w[0][0] = w[1][0] = 1;     for (long long i = 1; i < n; i++) w[0][i] = mul(w[0][i - 1], dan);     for (long long i = 1; i < n; i++) w[1][i] = w[0][n - i];     for (long long i = 0; i < len; i++) {       if (i & 1)         rev[i] = (rev[i >> 1] >> 1) | (len >> 1);       else         rev[i] = rev[i >> 1] >> 1;     }   }   void fft(long long *a, long long o) {     for (long long i = 0; i < len; i++)       if (i < rev[i]) swap(a[i], a[rev[i]]);     for (long long k = 2, dan, now, t; k <= len; k <<= 1) {       dan = qp(g, (o ? (mod - 1 - (mod - 1) / k) : (mod - 1) / k));       for (long long i = 0; i < len; i += k) {         now = 1;         for (long long j = 0; j < (k >> 1); j++, now = mul(now, dan)) {           t = mul(a[i + j + (k >> 1)], now);           a[i + j + (k >> 1)] = (a[i + j] - t + mod) % mod;           a[i + j] = (a[i + j] + t) % mod;         }       }     }     if (o) {       long long inv = qp(len, mod - 2);       for (long long i = 0; i < len; i++) a[i] = mul(a[i], inv);     }   }   void init(long long o) {     for (long long i = 0; i < 2 * n; i++) pw[i] = w[o][(i * (i - 1) / 2) % n];     for (long long i = 2 * n; i < len; i++) pw[i] = 0;     reverse(pw, pw + 2 * n);     fft(pw, 0);   }   void dft(long long *a, long long o) {     for (long long i = 0; i < n; i++)       tmp[i] = mul(a[i], w[o][(n - (i * (i - 1) / 2) % n) % n]);     for (long long i = n; i < len; i++) tmp[i] = 0;     fft(tmp, 0);     for (long long i = 0; i < len; i++) tmp[i] = mul(tmp[i], pw[i]);     fft(tmp, 1);     reverse(tmp, tmp + 2 * n);     for (long long i = 0; i < n; i++)       a[i] = mul(tmp[i], w[o][(n - (i * (i - 1) / 2) % n) % n]);     if (o) {       long long inv = qp(n, mod - 2);       for (long long i = 0; i < n; i++) a[i] = mul(a[i], inv);     }   }   long long ans[5], ans_cnt;   signed main() {     scanf( %lld , &n);     init();     for (long long i = 0; i < n; i++) scanf( %lld , &b[i]);     for (long long i = 0; i < n; i++) scanf( %lld , &c[i]);     for (long long i = 0, inv = qp(mod - 2, mod - 2); i < n; i++)       d[i] = mul((c[(i + 1) % n] - c[i] + mod) % mod, inv), e[i] = b[i];     init(0);     dft(d, 0);     reverse(e + 1, e + n);     dft(e, 0);     for (long long i = 0; i < n; i++) f[i] = mul(d[i], qp(e[i], mod - 2));     init(1);     dft(f, 1);     long long x2 = 0, x1 = 0, x0 = -c[0];     for (long long i = 0, now = 0, k; i < n; i++) {       k = b[i] - now;       x2++;       x1 -= 2 * k;       x0 += k * k;       a[i] = ((f[i] < mod - f[i]) ? f[i] : f[i] - mod);       if (a[i] > 1000000) {         puts( 0 );         return 0;       }       now = now + a[i];     }     long long det = x1 * x1 - 4 * x2 * x0, sq = sqrt(det);     if (det < 0 || sq * sq != det) {       puts( 0 );       return 0;     }     if (((-x1 - sq) % (2 * x2)) == 0) ans[++ans_cnt] = (-x1 - sq) / (2 * x2);     if (((-x1 + sq) % (2 * x2)) == 0 && (!ans_cnt || sq))       ans[++ans_cnt] = (-x1 + sq) / (2 * x2);     printf( %lld n , ans_cnt);     if (!ans_cnt) return 0;     for (long long t = 1, now; t <= ans_cnt; t++) {       now = ans[t];       printf( %lld  , now);       for (long long i = 0; i < n - 1; i++) {         now = now + a[i];         printf( %lld  , now);       }       puts(  );     }     return 0;   }