Problem: <image>

Senor Vorpal Kickass'o invented an innovative method to encrypt integer sequences of length n. To encrypt a sequence, one has to choose a secret sequence <image>, that acts as a key.

Vorpal is very selective, so the key should be such a sequence bi, that its cyclic shifts are linearly independent, that is, there is no non-zero set of coefficients x0, x1, ..., xn - 1, such that <image> for all k at the same time.

After that for a sequence <image> you should build the following cipher:

<image>

In other words, you are to compute the quadratic deviation between each cyclic shift of bi and the sequence ai. The resulting sequence is the Kickass's cipher. The cipher is in development right now and Vorpal wants to decipher a sequence after it has been encrypted. You are to solve this problem for him. You are given sequences ci and bi. You are to find all suitable sequences ai.

Input

The first line contains a single integer n (<image>).

The second line contains n integers b0, b1, ..., bn - 1 (<image>).

The third line contains n integers c0, c1, ..., cn - 1 (<image>).

It is guaranteed that all cyclic shifts of sequence bi are linearly independent.

Output

In the first line print a single integer k — the number of sequences ai, such that after encrypting them with key bi you get the sequence ci.

After that in each of k next lines print n integers a0, a1, ..., an - 1. Print the sequences in lexicographical order.

Note that k could be equal to 0.

Examples

Input

1
1
0


Output

1
1


Input

1
100
81


Output

2
91
109


Input

3
1 1 3
165 185 197


Output

2
-6 -9 -1
8 5 13

Solution (in CPP):

Solution:
#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("");
  }
}