Problem: 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>.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize(2)
const int mod = 1e9 + 7;
const int MAXR = 55, MAXSIZ = 7850, MAXP = MAXR * MAXR * 4;
template <typename _T>
void read(_T &x) {
  x = 0;
  char s = getchar();
  int f = 1;
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = (x << 3) + (x << 1) + (s - '0'), s = getchar();
  }
  x *= f;
}
template <typename _T>
void write(_T x) {
  if (x < 0) {
    putchar('-');
    x = (~x) + 1;
  }
  if (9 < x) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename _T>
_T ABS(const _T a) {
  return a < 0 ? -a : a;
}
template <typename _T>
void swapp(_T &x, _T &y) {
  _T t = x;
  x = y, y = t;
}
template <typename _T>
_T MAX(const _T a, const _T b) {
  return a > b ? a : b;
}
std ::pair<int, int> p[MAXSIZ];
int A[MAXSIZ][MAXSIZ], E[MAXSIZ];
int dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
int pos[MAXP];
int R, siz, band;
int qkpow(int base, int indx) {
  int ret = 1;
  while (indx) {
    if (indx & 1) ret = 1ll * ret * base % mod;
    base = 1ll * base * base % mod, indx >>= 1;
  }
  return ret;
}
double sqr(const double x) { return x * x; }
int inv(const int a) { return qkpow(a, mod - 2); }
int fix(const int a) { return (a % mod + mod) % mod; }
int HASH(const int x, const int y) { return (x + R) * R * 2 + y + R; }
double dist(double ax, double ay, double bx = 0, double by = 0) {
  return sqrt(sqr(ax - bx) + sqr(ay - by));
}
void Gauss() {
  int indx, tmp;
  for (int i = 1, opt = 1; i <= siz && opt <= siz; i++, opt++) {
    indx = -1;
    for (int j = opt; j <= siz; j++)
      if (A[i][j]) {
        indx = j;
        break;
      }
    if (!(~indx)) {
      opt--;
      continue;
    }
    for (int j = 1; j <= siz; j++) swapp(A[j][opt], A[j][indx]);
    tmp = inv(A[i][opt]);
    A[i][siz + 1] = 1ll * A[i][siz + 1] * tmp % mod;
    for (int j = opt; j <= siz && j <= opt + band; j++)
      A[i][j] = 1ll * A[i][j] * tmp % mod;
    for (int j = i + 1; j <= i + band && j <= siz; j++)
      if (A[j][opt]) {
        tmp = A[j][opt];
        A[j][siz + 1] = fix(A[j][siz + 1] - 1ll * tmp * A[i][siz + 1] % mod);
        for (int k = opt; k <= siz && k <= opt + band; k++)
          A[j][k] = fix(A[j][k] - 1ll * tmp * A[i][k] % mod);
      }
  }
  for (int i = siz; i; i--) {
    indx = -1;
    for (int j = 1; j <= siz; j++)
      if (A[i][j] == 1) {
        indx = j;
        break;
      }
    if (!(~indx)) continue;
    E[indx] = A[i][siz + 1];
    for (int j = 1; j < i; j++)
      A[j][siz + 1] = fix(A[j][siz + 1] - 1ll * A[j][indx] * E[indx] % mod),
                 A[j][indx] = 0;
  }
}
int main() {
  int ch[4];
  read(R);
  for (int i = 0; i < 4; i++) read(ch[i]);
  for (int i = -R; i <= R; i++)
    for (int j = -R; j <= R; j++)
      if (dist(i, j) <= R)
        p[pos[HASH(i, j)] = ++siz] = std ::pair<int, int>(i, j);
  int tmp = 0;
  for (int i = 0; i < 4; i++) tmp = (tmp + ch[i]) % mod;
  tmp = inv(tmp);
  for (int i = 0; i < 4; i++) ch[i] = 1ll * ch[i] * tmp % mod;
  for (int i = 1, x, y, t; i <= siz; i++) {
    x = p[i].first, y = p[i].second;
    A[i][i] = 1, A[i][siz + 1] = 1;
    for (int k = 0, tx, ty; k < 4; k++)
      if (dist(tx = dir[k][0] + x, ty = dir[k][1] + y) <= R)
        A[i][t = pos[HASH(tx, ty)]] = fix(-ch[k]), band = MAX(band, ABS(t - i));
  }
  Gauss();
  write(E[pos[HASH(0, 0)]]), putchar('\n');
  return 0;
}