#include <bits/stdc++.h>
int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int oo = INT_MAX;
const long long int OO = 1e18;
const int monthly[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int alldx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int alldy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[] = {1, -1, 0, 0, 0, 0};
const int dy[] = {0, 0, 1, -1, 0, 0};
const int dz[] = {0, 0, 0, 0, 1, -1};
using namespace std;
string Letters = "0123456789ABCDEF";
int toInt(char c) { return Letters.find(c); }
long long int FromAnyBaseToDecimal(string inp, int base) {
  long long int res = 0;
  for (long long int i = (0) - ((0) > (inp.size()));
       i != (inp.size()) - ((0) > (inp.size()));
       i += 1 - 2 * ((0) > (inp.size()))) {
    res *= base;
    res += toInt(inp[i]);
  }
  return res;
}
string FromDecimalToAnyBase(long long int n, int base) {
  if (n == 0) return "0";
  string ans = "";
  while (n) {
    ans = Letters[n % base] + ans;
    n /= base;
  }
  return ans;
}
long long int GCD(long long int a, long long int b) {
  return ((!b) ? a : GCD(b, a % b));
}
long long int LCM(long long int a, long long int b) {
  return a / (GCD(a, b)) * b;
}
long long int nCr(long long int n, long long int r) {
  if (n < r) return 0;
  if (r == 0) return 1;
  return n * nCr(n - 1, r - 1) / r;
}
long long int PowMod(long long int bs, long long int ex, long long int M) {
  if (!ex) return 1;
  long long int p = PowMod((bs * bs) % M, ex >> 1, M);
  return (ex & 1) ? (p * bs) % M : p;
}
long long int fastpow(long long int b, long long int e) {
  if (!e) return 1;
  if (e & 1) return b * fastpow(b, e - 1);
  long long int x = fastpow(b, e / 2);
  return x * x;
}
long long int ModInverse(long long int a) { return PowMod(a, MOD - 2, MOD); }
long long int ExtGCD(long long int a, long long int b, long long int& x,
                     long long int& y) {
  if (!b) {
    x = 1;
    y = 0;
    return a;
  }
  long long int r = ExtGCD(b, a % b, y, x);
  y -= a / b * x;
  return r;
}
long long int mult(long long int a, long long int b) {
  return (1LL * a * b) % MOD;
}
long long int SumOfOdd(long long int l, long long int r) {
  long long int Rsm = (r + 1) / 2;
  Rsm *= Rsm;
  l--;
  long long int Lsm = (l + 1) / 2;
  Lsm *= Lsm;
  return Rsm - Lsm;
}
long long int NoOfOdd(long long int L, long long int R) {
  long long int N = (R - L) / 2;
  if (R % 2 != 0 || L % 2 != 0) N++;
  return N;
}
long long int NoOfEven(long long int L, long long int R) {
  return ((R - L + 1) - NoOfOdd(L, R));
}
bool PointInRectangle(long long int x1, long long int y1, long long int x2,
                      long long int y2, long long int x, long long int y) {
  return (x >= x1 && x <= x2 && y >= y1 && y <= y2);
}
bool isPrime(long long int n) {
  if (n == 2) return 1;
  if (n < 2 || n % 2 == 0) return 0;
  for (long long int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return 0;
  return 1;
}
bool isPalindrome(string str) {
  long long int l = 0;
  long long int h = str.size() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool isPerfectCube(long long int n) {
  long long int curoot = round(pow(n, 1.0 / 3.0));
  return (pow(curoot, 3) == n);
}
double distance(double x1, double y1, double x2, double y2) {
  return hypot(fabs(x1 - x2), fabs(y1 - y2));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a1, a2, a3;
  int b1, b2, b3;
  int c1, c2, c3;
  cin >> a1 >> a2 >> a3;
  cin >> b1 >> b2 >> b3;
  cin >> c1 >> c2 >> c3;
  int a = a2 + a3;
  int b = b1 + b3;
  int c = c1 + c2;
  int s = (a + b + c) / 2;
  cout << s - a << ' ' << a2 << ' ' << a3 << '\n';
  cout << b1 << ' ' << s - b << ' ' << b3 << '\n';
  cout << c1 << ' ' << c2 << ' ' << s - c << '\n';
}

### Prompt

Create a solution in CPP for the following problem:

Little Elephant loves magic squares very much.

A magic square is a 3 × 3 table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table are equal. The figure below shows the magic square, the sum of integers in all its rows, columns and diagonals equals 15.

<image>

The Little Elephant remembered one magic square. He started writing this square on a piece of paper, but as he wrote, he forgot all three elements of the main diagonal of the magic square. Fortunately, the Little Elephant clearly remembered that all elements of the magic square did not exceed 105. 

Help the Little Elephant, restore the original magic square, given the Elephant's notes.

Input

The first three lines of the input contain the Little Elephant's notes. The first line contains elements of the first row of the magic square. The second line contains the elements of the second row, the third line is for the third row. The main diagonal elements that have been forgotten by the Elephant are represented by zeroes.

It is guaranteed that the notes contain exactly three zeroes and they are all located on the main diagonal. It is guaranteed that all positive numbers in the table do not exceed 105.

Output

Print three lines, in each line print three integers — the Little Elephant's magic square. If there are multiple magic squares, you are allowed to print any of them. Note that all numbers you print must be positive and not exceed 105.

It is guaranteed that there exists at least one magic square that meets the conditions.

Examples

Input

0 1 1
1 0 1
1 1 0


Output

1 1 1
1 1 1
1 1 1


Input

0 3 6
5 0 5
4 7 0


Output

6 3 6
5 5 5
4 7 4

### Response

```cpp
#include <bits/stdc++.h>
int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int oo = INT_MAX;
const long long int OO = 1e18;
const int monthly[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int alldx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int alldy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[] = {1, -1, 0, 0, 0, 0};
const int dy[] = {0, 0, 1, -1, 0, 0};
const int dz[] = {0, 0, 0, 0, 1, -1};
using namespace std;
string Letters = "0123456789ABCDEF";
int toInt(char c) { return Letters.find(c); }
long long int FromAnyBaseToDecimal(string inp, int base) {
  long long int res = 0;
  for (long long int i = (0) - ((0) > (inp.size()));
       i != (inp.size()) - ((0) > (inp.size()));
       i += 1 - 2 * ((0) > (inp.size()))) {
    res *= base;
    res += toInt(inp[i]);
  }
  return res;
}
string FromDecimalToAnyBase(long long int n, int base) {
  if (n == 0) return "0";
  string ans = "";
  while (n) {
    ans = Letters[n % base] + ans;
    n /= base;
  }
  return ans;
}
long long int GCD(long long int a, long long int b) {
  return ((!b) ? a : GCD(b, a % b));
}
long long int LCM(long long int a, long long int b) {
  return a / (GCD(a, b)) * b;
}
long long int nCr(long long int n, long long int r) {
  if (n < r) return 0;
  if (r == 0) return 1;
  return n * nCr(n - 1, r - 1) / r;
}
long long int PowMod(long long int bs, long long int ex, long long int M) {
  if (!ex) return 1;
  long long int p = PowMod((bs * bs) % M, ex >> 1, M);
  return (ex & 1) ? (p * bs) % M : p;
}
long long int fastpow(long long int b, long long int e) {
  if (!e) return 1;
  if (e & 1) return b * fastpow(b, e - 1);
  long long int x = fastpow(b, e / 2);
  return x * x;
}
long long int ModInverse(long long int a) { return PowMod(a, MOD - 2, MOD); }
long long int ExtGCD(long long int a, long long int b, long long int& x,
                     long long int& y) {
  if (!b) {
    x = 1;
    y = 0;
    return a;
  }
  long long int r = ExtGCD(b, a % b, y, x);
  y -= a / b * x;
  return r;
}
long long int mult(long long int a, long long int b) {
  return (1LL * a * b) % MOD;
}
long long int SumOfOdd(long long int l, long long int r) {
  long long int Rsm = (r + 1) / 2;
  Rsm *= Rsm;
  l--;
  long long int Lsm = (l + 1) / 2;
  Lsm *= Lsm;
  return Rsm - Lsm;
}
long long int NoOfOdd(long long int L, long long int R) {
  long long int N = (R - L) / 2;
  if (R % 2 != 0 || L % 2 != 0) N++;
  return N;
}
long long int NoOfEven(long long int L, long long int R) {
  return ((R - L + 1) - NoOfOdd(L, R));
}
bool PointInRectangle(long long int x1, long long int y1, long long int x2,
                      long long int y2, long long int x, long long int y) {
  return (x >= x1 && x <= x2 && y >= y1 && y <= y2);
}
bool isPrime(long long int n) {
  if (n == 2) return 1;
  if (n < 2 || n % 2 == 0) return 0;
  for (long long int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return 0;
  return 1;
}
bool isPalindrome(string str) {
  long long int l = 0;
  long long int h = str.size() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool isPerfectCube(long long int n) {
  long long int curoot = round(pow(n, 1.0 / 3.0));
  return (pow(curoot, 3) == n);
}
double distance(double x1, double y1, double x2, double y2) {
  return hypot(fabs(x1 - x2), fabs(y1 - y2));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int a1, a2, a3;
  int b1, b2, b3;
  int c1, c2, c3;
  cin >> a1 >> a2 >> a3;
  cin >> b1 >> b2 >> b3;
  cin >> c1 >> c2 >> c3;
  int a = a2 + a3;
  int b = b1 + b3;
  int c = c1 + c2;
  int s = (a + b + c) / 2;
  cout << s - a << ' ' << a2 << ' ' << a3 << '\n';
  cout << b1 << ' ' << s - b << ' ' << b3 << '\n';
  cout << c1 << ' ' << c2 << ' ' << s - c << '\n';
}

```