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>
inline long long rd() {
  long long _x = 0;
  int _ch = getchar(), _f = 1;
  for (; !isdigit(_ch) && (_ch != '-') && (_ch != EOF); _ch = getchar())
    ;
  if (_ch == '-') {
    _f = 0;
    _ch = getchar();
  }
  for (; isdigit(_ch); _ch = getchar()) _x = _x * 10 + _ch - '0';
  return _f ? _x : -_x;
}
void write(long long _x) {
  if (_x >= 10)
    write(_x / 10), putchar(_x % 10 + '0');
  else
    putchar(_x + '0');
}
inline void wrt(long long _x, char _p) {
  if (_x < 0) putchar('-'), _x = -_x;
  write(_x);
  if (_p) putchar(_p);
}
int R;
inline int qpow(int x, int k = 1000000007 - 2) {
  int ans = 1;
  for (; k; k >>= 1, x = 1ll * x * x % 1000000007)
    if (k & 1) ans = 1ll * ans * x % 1000000007;
  return ans;
}
int a[8005][8005];
int h[305][305], cnt, total;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
int p[4];
int f[8005];
int B, Pos[8005];
inline int Mod(int x) { return x >= 1000000007 ? x - 1000000007 : x; }
void Gauss() {
  for (int i = 1; i <= total; i++) Pos[i] = i;
  for (int i = 1, opt = 1, idx, tmp; i <= total && opt <= total; i++, opt++) {
    idx = -1;
    for (int j = opt; j <= total; j++)
      if (a[i][j]) {
        idx = j;
        break;
      }
    if (idx == -1) {
      opt--;
      continue;
    }
    std::swap(Pos[opt], Pos[idx]);
    for (int j = 1; j <= total; j++) std::swap(a[j][opt], a[j][idx]);
    tmp = qpow(a[i][opt]);
    a[i][total + 1] = 1ll * a[i][total + 1] * tmp % 1000000007;
    for (int j = opt; j <= total && j <= opt + B; j++)
      a[i][j] = 1ll * a[i][j] * tmp % 1000000007;
    for (int j = i + 1; j <= i + B && j <= total; j++)
      if (a[j][opt]) {
        tmp = a[j][opt];
        a[j][total + 1] =
            Mod(a[j][total + 1] - 1ll * tmp * a[i][total + 1] % 1000000007 +
                1000000007);
        for (int k = opt; k <= total && k <= opt + B; k++)
          a[j][k] =
              Mod(a[j][k] - 1ll * tmp * a[i][k] % 1000000007 + 1000000007);
      }
  }
  for (int i = total, idx; i >= 1; i--) {
    idx = -1;
    for (int j = 1; j <= total; j++)
      if (a[i][j] == 1) {
        idx = j;
        break;
      }
    if (idx == -1) continue;
    f[Pos[idx]] = a[i][total + 1];
    for (int j = 1; j < i; j++) {
      a[j][total + 1] = Mod(a[j][total + 1] -
                            1ll * a[j][idx] * f[idx] % 1000000007 + 1000000007);
      a[j][idx] = 0;
    }
  }
}
int main() {
  R = rd(), p[0] = rd(), p[1] = rd(), p[2] = rd(), p[3] = rd();
  int S = p[0] + p[1] + p[2] + p[3];
  for (int i = 0; i < 4; i++) {
    p[i] = 1ll * p[i] * qpow(S) % 1000000007;
  }
  for (int i = -R - 1; i <= R + 1; i++) {
    for (int j = -R - 1; j <= R + 1; j++)
      if (i * i + j * j <= R * R) {
        for (int k = 0; k < 4; k++) {
          int x = i + dx[k], y = j + dy[k];
        }
        h[i + 100][j + 100] = ++cnt;
      }
  }
  for (int i = -R - 1; i <= R + 1; i++) {
    for (int j = -R - 1; j <= R + 1; j++)
      if (h[i + 100][j + 100]) {
        total++;
        int sum = 0;
        for (int k = 0; k < 4; k++) {
          int x = i + dx[k], y = j + dy[k];
          if (x * x + y * y > R * R) continue;
          a[total][h[x + 100][y + 100]] = 1000000007 - p[k];
          sum = (sum + p[k]) % 1000000007;
          B = std::max(B, abs(h[x + 100][y + 100] - h[i + 100][j + 100]));
        }
        a[total][h[i + 100][j + 100]] = 1;
        a[total][cnt + 1] = 1;
      }
  }
  Gauss();
  wrt(f[h[0 + 100][0 + 100]], '\n');
}
