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;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int r, n, m, a1, a2, a3, a4, sum, a[8010][8010], b[10010], ans[10010],
    pos[10010];
bool vis[8010];
map<pair<int, int>, int> id;
int qpow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % mod;
    a = 1ll * a * a % mod, b >>= 1;
  }
  return ret;
}
int main() {
  r = gi(), a1 = gi(), a2 = gi(), a3 = gi(), a4 = gi();
  m = r + r + 1;
  sum = a1 + a2 + a3 + a4, sum = qpow(sum, mod - 2);
  a1 = 1ll * a1 * sum % mod, a2 = 1ll * a2 * sum % mod,
  a3 = 1ll * a3 * sum % mod, a4 = 1ll * a4 * sum % mod;
  for (int i = -r; i <= r; i++)
    for (int j = -r; j <= r; j++)
      if (i * i + j * j <= r * r) id[make_pair(i, j)] = ++n;
  for (int i = -r; i <= r; i++)
    for (int j = -r, x, y; j <= r; j++)
      if (x = id[make_pair(i, j)]) {
        if (y = id[make_pair(i - 1, j)]) a[x][y] = a1;
        if (y = id[make_pair(i, j - 1)]) a[x][y] = a2;
        if (y = id[make_pair(i + 1, j)]) a[x][y] = a3;
        if (y = id[make_pair(i, j + 1)]) a[x][y] = a4;
        a[x][x] = b[x] = mod - 1;
      }
  for (int i = 1; i <= n; i++) {
    int p = 0;
    for (int j = max(1, i - m); j <= min(n, i + m); j++)
      if (!vis[j] && a[j][i]) {
        p = j;
        break;
      }
    assert(pos[i] = p);
    vis[p] = 1;
    int inv = qpow(a[p][i], mod - 2);
    for (int j = i; j <= n && j <= p + m; j++)
      a[p][j] = 1ll * a[p][j] * inv % mod;
    b[p] = 1ll * b[p] * inv % mod;
    for (int j = p + 1; j <= n && j <= i + m; j++) {
      int tmp = mod - a[j][i];
      for (int k = i; k <= n && k <= p + m; k++)
        a[j][k] = (a[j][k] + 1ll * tmp * a[p][k]) % mod;
      b[j] = (b[j] + 1ll * tmp * b[p]) % mod;
    }
  }
  for (int i = n; i; i--) {
    ans[i] = b[pos[i]];
    for (int j = i + 1; j <= n && j <= i + m; j++)
      ans[i] = (ans[i] + 1ll * (mod - a[pos[i]][j]) * ans[j]) % mod;
  }
  printf("%d\n", ans[id[make_pair(0, 0)]]);
  return 0;
}
