#include <bits/stdc++.h>
using namespace std;
const int N = 400005;
long long b[N], c[N], da[N];
long long A[N], B[N], p[N];
long long g, moo;
int n, FFTN;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long mul(long long x, long long y) {
  long long t = x * y - (long long)((long double)x / moo * y) * moo;
  return (t % moo + moo) % moo;
}
long long power(long long x, long long y) {
  long long s = 1;
  for (; y; y /= 2, x = mul(x, x))
    if (y & 1) s = mul(s, x);
  return s;
}
void init_root() {
  FFTN = 4;
  for (; FFTN <= n * 2; FFTN <<= 1)
    ;
  long long dif = FFTN / gcd(FFTN, n) * 1ll * n;
  moo = (100000000 / dif + 1) * dif + 1;
  for (;; moo += dif) {
    bool flag = 0;
    for (int i = 2; 1ll * i * i <= moo && !flag; i++)
      if (moo % i == 0) flag = 1;
    if (!flag) break;
  }
  static long long di[50];
  long long x = moo - 1;
  for (int i = 2; 1ll * i * i <= x; i++)
    if (x % i == 0) {
      di[++*di] = i;
      for (; x % i == 0; x /= i)
        ;
    }
  if (x != 1) di[++*di] = x;
  for (g = 1;; ++g) {
    bool flag = 0;
    for (int i = (int)(1); i <= (int)(*di); i++)
      if (power(g, (moo - 1) / di[i]) == 1) {
        flag = 1;
        break;
      }
    if (!flag) break;
  }
  p[0] = 1;
  p[1] = power(g, (moo - 1) / n);
  for (int i = (int)(2); i <= (int)(n - 1); i++) p[i] = mul(p[i - 1], p[1]);
}
int R[N];
int FFT_init(int n) {
  int L = 1;
  for (; L <= n; L <<= 1)
    ;
  for (int i = (int)(0); i <= (int)(L - 1); i++)
    R[i] = (R[i >> 1] >> 1) | ((i & 1) ? (L >> 1) : 0);
  return L;
}
void _DFT(long long *a, int n, int f) {
  for (int i = (int)(0); i <= (int)(n - 1); i++)
    if (i < R[i]) swap(a[i], a[R[i]]);
  for (int d = 1; d < n; d <<= 1) {
    long long w = power(g, (moo - 1) / (d << 1));
    if (f == -1) w = power(w, moo - 2);
    for (int i = 0; i < n; i += (d << 1)) {
      long long wn = 1;
      for (int j = 0; j < d; j++) {
        long long y = mul(a[i + j + d], wn);
        a[i + j + d] = (a[i + j] + moo - y) % moo;
        a[i + j] = (a[i + j] + y) % moo;
        wn = mul(wn, w);
      }
    }
  }
  if (f == -1) {
    long long val = power(n, moo - 2);
    for (int i = (int)(0); i <= (int)(n - 1); i++) a[i] = mul(a[i], val);
  }
}
void DFT(long long *a, int f = 1) {
  int L = FFT_init(2 * n);
  static long long A[N], B[N];
  for (int i = (int)(0); i <= (int)(L - 1); i++) A[i] = B[i] = 0;
  for (int i = (int)(0); i <= (int)(2 * n); i++)
    A[i] = p[(n + 1ll * i * (i + 1) / 2 * f % n) % n];
  for (int i = (int)(0); i <= (int)(n); i++)
    B[n - i] = mul(a[i], p[(n - 1ll * i * (i + 1) / 2 * f % n) % n]);
  _DFT(A, L, 1);
  _DFT(B, L, 1);
  for (int i = (int)(0); i <= (int)(L - 1); i++) A[i] = mul(A[i], B[i]);
  _DFT(A, L, -1);
  for (int i = (int)(0); i <= (int)(n); i++)
    a[i] = mul(A[i + n], p[(n - 1ll * i * (i + 1) / 2 * f % n) % n]);
  if (f == -1) {
    long long val = power(n, moo - 2);
    for (int i = (int)(0); i <= (int)(n - 1); i++) a[i] = mul(a[i], val);
  }
}
set<long long> S;
void calc_root(long long a, long long b, long long c) {
  long long delta = b * b - 4 * a * c;
  if (delta < 0) return;
  long long v = (long long)(sqrt(delta) - 0.5);
  for (; v * v < delta; ++v)
    ;
  if (v * v != delta) return;
  if ((-b + v) % (2 * a) == 0) S.insert((-b + v) / (2 * a));
  if ((-b - v) % (2 * a) == 0) S.insert((-b - v) / (2 * a));
}
void GG() {
  puts("0");
  exit(0);
}
int main() {
  scanf("%d", &n);
  init_root();
  for (int i = (int)(0); i <= (int)(n - 1); i++) scanf("%lld", &b[i]);
  for (int i = (int)(0); i <= (int)(n - 1); i++) scanf("%lld", &c[i]);
  for (int i = (int)(0); i <= (int)(n - 1); i++)
    if ((c[i] + c[0]) & 1) GG();
  for (int i = (int)(0); i <= (int)(n - 1); i++)
    A[i] = ((c[(i + 1) % n] - c[i]) / 2 + moo) % moo, B[(n - i) % n] = b[i];
  DFT(A);
  DFT(B);
  for (int i = (int)(0); i <= (int)(n - 1); i++)
    A[i] = mul(A[i], power(B[i], moo - 2));
  DFT(A, -1);
  for (int i = (int)(0); i <= (int)(n - 1); i++) {
    if (A[i] < 10000)
      da[i] = A[i];
    else if (A[i] >= moo - 10000)
      da[i] = A[i] - moo;
    else
      GG();
  }
  long long dsum = 0, va = 0, vb = 0, vc = 0;
  for (int i = (int)(0); i <= (int)(n - 1); i++) {
    long long v = b[i] - dsum;
    va += v * v;
    vb -= 2 * v;
    vc++;
    dsum -= da[i];
  }
  if (dsum) GG();
  calc_root(vc, vb, va - c[0]);
  printf("%d\n", S.size());
  for (auto i : S) {
    long long val = i;
    for (int j = (int)(0); j <= (int)(n - 1); j++) {
      printf("%lld ", val);
      val -= da[j];
    }
    puts("");
  }
}
