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;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while ((c < '0' || c > '9') && c ^ '-') c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - 48;
    c = getchar();
  }
  return x * f;
}
const int mo = 1e9 + 7, N = 7900;
int a1, a2, a3, a4, p[5], id[50000];
inline int qp(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = 1ll * ans * x % mo;
    x = 1ll * x * x % mo;
    y >>= 1;
  }
  return ans;
}
inline int qumo(int x) { return x + ((x >> 31) & mo); }
int ju, r, lim, jb, zn, gs = 0;
inline int max(int x, int y) { return x < y ? y : x; }
inline int min(int x, int y) { return x < y ? x : y; }
int jie[N], tot;
struct mat {
  int a[N][N], dui[10];
  bool you[N];
  inline void xiaoyuan() {
    int ys = tot;
    for (int i = 1; i <= ys; i++) {
      int hang = i;
      while (!a[hang][i] && hang <= ys) hang++;
      if (hang > ys) continue;
      const int ni = qp(a[hang][i], mo - 2);
      int g1 = max(1, hang - (lim << 1)), g2 = min(ys, hang + (lim << 1));
      dui[0] = 0;
      for (int j = i + 1; j <= ys; j++)
        if (a[i][j]) dui[++dui[0]] = j;
      for (int j = g1; j <= g2; j++) {
        if (j == hang) continue;
        int xs = 1ll * ni * a[j][i] % mo;
        if (!xs) continue;
        a[j][i] = 0;
        for (int k = 1; k <= dui[0]; k++)
          a[j][dui[k]] = qumo(a[j][dui[k]] - 1ll * xs * a[hang][dui[k]] % mo);
        a[j][0] = qumo(a[j][0] - 1ll * xs * a[hang][0] % mo);
      }
    }
    for (int i = ys; i >= 1; i--) {
      int lao = a[i][0], bh = 0;
      for (int j = 1; j <= ys; j++)
        if (a[i][j]) {
          if (you[j])
            lao = qumo(lao - 1ll * a[i][j] * jie[j] % mo);
          else
            bh = j;
        }
      if (bh) you[bh] = 1, jie[bh] = 1ll * lao * qp(a[i][bh], mo - 2) % mo;
    }
  }
} f;
inline bool panzai(int x, int y, int xx, int yy) {
  return (xx - x) * (xx - x) + (yy - y) * (yy - y) <= r * r;
}
int dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
inline int get_bh(int x, int y) { return (x - 1) * lim + y; }
int main() {
  r = read();
  a1 = read();
  a2 = read();
  a3 = read();
  a4 = read();
  jb = a1 + a2 + a3 + a4;
  jb = qp(jb, mo - 2);
  p[0] = 1ll * a1 * jb % mo;
  p[1] = 1ll * a2 * jb % mo;
  p[2] = 1ll * a3 * jb % mo;
  p[3] = 1ll * a4 * jb % mo;
  lim = ((r + 1) << 1) + 1;
  zn = (lim >> 1) + 1;
  for (int i = 1; i <= lim; i++)
    for (int j = 1; j <= lim; j++)
      if (panzai(i, j, zn, zn)) {
        int bh = get_bh(i, j);
        id[bh] = ++tot;
      }
  for (int i = 1; i <= lim; i++)
    for (int j = 1; j <= lim; j++)
      if (panzai(i, j, zn, zn)) {
        int bh = id[get_bh(i, j)];
        for (int k = 0; k < 4; k++) {
          int tx = i + dir[k][0], ty = j + dir[k][1], bh2 = id[get_bh(tx, ty)];
          if (panzai(tx, ty, zn, zn)) f.a[bh][bh2] = p[k];
        }
        f.a[bh][bh] = mo - 1;
        f.a[bh][0] = mo - 1;
      }
  f.xiaoyuan();
  cout << jie[id[(r + 1) * lim + (r + 2)]] << "\n";
  return 0;
}
