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;
const int Mod = 1e9 + 7, N = 7850;
void add_to(int &x, int y) {
  x += y;
  if (x >= Mod) x -= Mod;
}
void inm_to(int &x, int y) { x = (long long)x * y % Mod; }
int inm(int x, int y) { return (long long)x * y % Mod; }
int power(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) inm_to(ans, a);
    inm_to(a, a);
    b >>= 1;
  }
  return ans;
}
int inv(int x) { return power(x, Mod - 2); }
int i, R, prob[4], sum, a[N][N], ans[N], j, id[105][105], ids, x, y, last, ct,
    k;
pair<int, int> ec[N];
int dx[4] = {-1, 0, +1, 0};
int dy[4] = {0, -1, 0, +1};
int main() {
  cin >> R;
  int D = R + 1;
  for (i = 0; i < 4; ++i) cin >> prob[i], add_to(sum, prob[i]);
  sum = inv(sum);
  for (i = 0; i < 4; ++i) inm_to(prob[i], sum);
  for (i = -R; i <= R; ++i)
    for (j = -R; j <= R; ++j)
      if (i * i + j * j <= R * R) {
        id[i + D][j + D] = ++ids;
        ec[ids] = {i, j};
      }
  for (i = 1; i <= ids; ++i) {
    tie(x, y) = ec[i];
    a[i][i] = a[i][ids + 1] = 1;
    for (j = 0; j < 4; ++j)
      a[i][id[x + dx[j] + D][y + dy[j] + D]] = Mod - prob[j];
    a[i][0] = 0;
  }
  for (i = 1; i <= ids; ++i) {
    last = min(ids, i + 2 * R + 1);
    x = inv(a[i][i]);
    for (j = i; j <= last; ++j) inm_to(a[i][j], x);
    inm_to(a[i][ids + 1], x);
    for (j = i + 1; j <= last; ++j) {
      ct = a[j][i];
      for (k = i; k <= last; ++k) add_to(a[j][k], Mod - inm(a[i][k], ct));
      add_to(a[j][ids + 1], Mod - inm(a[i][ids + 1], ct));
    }
  }
  for (i = ids; i; --i) {
    ans[i] = inm(a[i][ids + 1], inv(a[i][i]));
    last = max(1, i - 2 * R - 1);
    for (j = last; j < i; ++j) {
      add_to(a[j][ids + 1], Mod - inm(a[j][i], ans[i]));
      a[j][i] = 0;
    }
  }
  cout << ans[id[D][D]] << '\n';
  return 0;
}
