A chip was placed on a field with coordinate system onto point (0, 0).

Every second the chip moves randomly. If the chip is currently at a point (x, y), after a second it moves to the point (x - 1, y) with probability p1, to the point (x, y - 1) with probability p2, to the point (x + 1, y) with probability p3 and to the point (x, y + 1) with probability p4. It's guaranteed that p1 + p2 + p3 + p4 = 1. The moves are independent.

Find out the expected time after which chip will move away from origin at a distance greater than R (i.e. <image> will be satisfied).

Input

First line contains five integers R, a1, a2, a3 and a4 (0 ≤ R ≤ 50, 1 ≤ a1, a2, a3, a4 ≤ 1000).

Probabilities pi can be calculated using formula <image>.

Output

It can be shown that answer for this problem is always a rational number of form <image>, where <image>.

Print P·Q - 1 modulo 109 + 7. 

Examples

Input

0 1 1 1 1


Output

1

Input

1 1 1 1 1


Output

666666674

Input

1 1 2 1 2


Output

538461545

Note

In the first example initially the chip is located at a distance 0 from origin. In one second chip will move to distance 1 is some direction, so distance to origin will become 1.

Answers to the second and the third tests: <image> and <image>.
#include <bits/stdc++.h>
using namespace std;
mt19937 rnd;
long long rand(long long a) { return (rnd() % a + a) % a; }
const long long inf = 1e9 + 2;
const long long max_n = 1e4 + 3, mod = 1e9 + 7;
long long sum(long long a, long long b) {
  long long r = a + b;
  if (r >= mod) r -= mod;
  if (r < 0) r += mod;
  return r;
}
long long mul(long long a, long long b) { return a * b % mod; }
long long binpow(long long a, long long b) {
  long long r = 1;
  for (; b; b /= 2, a = mul(a, a))
    if (b & 1) r = mul(r, a);
  return r;
}
long long rev(long long a) { return binpow(a, mod - 2); }
map<pair<long long, long long>, long long> number;
vector<vector<long long>> A;
long long r;
long long range;
void gauss() {
  long long need = number[make_pair(0, 0)];
  long long cnt = 0;
  long long n = (long long)A.size();
  for (long long i = 0; i < n; ++i) {
    long long num = rev(A[i][range]);
    for (auto& j : A[i]) j = mul(j, num);
    for (long long j = i + 1; j < min(n, i + 2 * r); ++j) {
      if (j == i || !A[j][i - j + range]) continue;
      long long num = A[j][i - j + range];
      for (long long k = max(0ll, j - range); k < min(n, range + i); ++k) {
        long long t1 = k - i + range, t2 = k - j + range;
        ++cnt;
        A[j][t2] = sum(A[j][t2], -mul(A[i][t1], num));
      }
      A[j][2 * range] = sum(A[j][2 * range], -mul(A[i][2 * range], num));
    }
  }
  for (long long i = n - 1; i >= 0; --i) {
    for (long long j = i - 1; j > max(0ll, i - 2 * r); --j) {
      A[j][2 * range] =
          sum(A[j][2 * range], -mul(A[j][i - j + range], A[i][2 * range]));
      A[j][i - j + range] = 0;
    }
  }
}
void run() {
  long long perc[4];
  long long one;
  cin >> r >> perc[0] >> perc[1] >> perc[2] >> perc[3];
  one = accumulate(perc, perc + 4, 0);
  perc[0] = mul(perc[0], rev(one)), perc[1] = mul(perc[1], rev(one)),
  perc[2] = mul(perc[2], rev(one)), perc[3] = mul(perc[3], rev(one));
  for (long long x = -r - 1; x <= r + 1; ++x)
    for (long long y = -r - 1; y <= r + 1; ++y)
      if (x * x + y * y <= (r + 1) * (r + 1))
        number[{x, y}] = (long long)number.size();
  long long n = (long long)number.size();
  r = (2 * r + 1);
  range = 3 * r;
  A.resize(n, vector<long long>(2 * range + 1));
  vector<long long> dx{-1, 0, 1, 0}, dy{0, -1, 0, 1};
  for (auto p : number) {
    long long x = p.first.first, y = p.first.second;
    long double id = p.second;
    A[id][range] = 1;
    A[id][2 * range] = 1;
    if (x * x + y * y > (r / 2) * (r / 2)) {
      A[id][2 * range] = 0;
      continue;
    }
    for (long long dir = 0; dir < 4; ++dir) {
      pair<long long, long long> tmp = {x + dx[dir], y + dy[dir]};
      if (number.count(tmp)) A[id][number[tmp] - id + range] = mod - perc[dir];
    }
  }
  gauss();
  cout << A[number[make_pair(0, 0)]][2 * range] << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(6);
  clock_t time = clock();
  long long t = 1;
  while (t--) run();
}
