Problem: This is an easier version of the problem. In this version, n ≤ 6.

Marek is working hard on creating strong testcases to his new algorithmic problem. You want to know what it is? Nah, we're not telling you. However, we can tell you how he generates the testcases.

Marek chooses an integer n and n^2 integers p_{ij} (1 ≤ i ≤ n, 1 ≤ j ≤ n). He then generates a random bipartite graph with 2n vertices. There are n vertices on the left side: ℓ_1, ℓ_2, ..., ℓ_n, and n vertices on the right side: r_1, r_2, ..., r_n. For each i and j, he puts an edge between vertices ℓ_i and r_j with probability p_{ij} percent.

It turns out that the tests will be strong only if a perfect matching exists in the generated graph. What is the probability that this will occur?

It can be shown that this value can be represented as P/Q where P and Q are coprime integers and Q not≡ 0 \pmod{10^9+7}. Let Q^{-1} be an integer for which Q ⋅ Q^{-1} ≡ 1 \pmod{10^9+7}. Print the value of P ⋅ Q^{-1} modulo 10^9+7.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 6). The following n lines describe the probabilities of each edge appearing in the graph. The i-th of the lines contains n integers p_{i1}, p_{i2}, ..., p_{in} (0 ≤ p_{ij} ≤ 100); p_{ij} denotes the probability, in percent, of an edge appearing between ℓ_i and r_j.

Output

Print a single integer — the probability that the perfect matching exists in the bipartite graph, written as P ⋅ Q^{-1} \pmod{10^9+7} for P, Q defined above.

Examples

Input


2
50 50
50 50


Output


937500007


Input


3
3 1 4
1 5 9
2 6 5


Output


351284554

Note

In the first sample test, each of the 16 graphs below is equally probable. Out of these, 7 have a perfect matching:

<image>

Therefore, the probability is equal to 7/16. As 16 ⋅ 562 500 004 = 1 \pmod{10^9+7}, the answer to the testcase is 7 ⋅ 562 500 004 mod{(10^9+7)} = 937 500 007.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long MOD = (long long)1e9 + 7;
long long add(long long x, long long y) {
  x += y;
  if (x >= MOD) return x - MOD;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + MOD;
  return x;
}
long long mult(long long x, long long y) { return (x * y) % MOD; }
long long bin_pow(long long x, long long p) {
  if (p == 0) return 1;
  if (p & 1) return mult(x, bin_pow(x, p - 1));
  return bin_pow(mult(x, x), p / 2);
}
long long rev(long long x) { return bin_pow(x, MOD - 2); }
const int N = 7;
const int M = (1 << N) + 1;
int ppc[M];
int idInPpc[M];
vector<int> maskForPpc[N + 1];
long long trans[N + 1][M][M];
int n;
unordered_map<long long, long long> dp[N + 1];
long long A[N][N];
void precalc() {
  for (int mask = 1; mask < (1 << n); mask++)
    ppc[mask] = ppc[mask >> 1] + (mask & 1);
  for (int mask = 0; mask < (1 << n); mask++) {
    int k = ppc[mask];
    idInPpc[mask] = (int)maskForPpc[k].size();
    maskForPpc[k].push_back(mask);
  }
  for (int k = 0; k <= n; k++)
    for (int i = 0; i < (int)maskForPpc[k].size(); i++) {
      int inM = maskForPpc[k][i];
      for (int mask = 0; mask < (1 << n); mask++) {
        long long res = 0;
        if ((mask & inM) == mask) continue;
        for (int v = 0; v < n; v++) {
          if (((mask >> v) & 1) == 0) continue;
          if ((inM >> v) & 1) continue;
          int nmask = inM | (1 << v);
          res |= 1LL << idInPpc[nmask];
        }
        trans[k][i][mask] = res;
      }
    }
}
void read() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      scanf("%lld", &A[i][j]);
      A[i][j] = mult(A[i][j], rev(100));
    }
}
int main() {
  scanf("%d", &n);
  precalc();
  read();
  dp[0][1] = 1;
  for (int k = 0; k < n; k++)
    for (int mask = 0; mask < (1 << n); mask++) {
      long long W = 1;
      for (int i = 0; i < n; i++) {
        if ((mask >> i) & 1)
          W = mult(W, A[k][i]);
        else
          W = mult(W, sub(1, A[k][i]));
      }
      for (pair<long long, long long> s : dp[k]) {
        long long zmask = s.first, val = s.second;
        long long nmask = 0;
        for (int i = 0; i < (int)maskForPpc[k].size(); i++) {
          if ((zmask >> i) & 1) nmask |= trans[k][i][mask];
        }
        if (nmask == 0) continue;
        val = mult(val, W);
        dp[k + 1][nmask] = add(dp[k + 1][nmask], val);
      }
    }
  printf("%lld\n", dp[n][1]);
  return 0;
}