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>
using namespace std;
long long pow_mod(long long x, int k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = ans * x % 1000000007;
    x = x * x % 1000000007;
    k >>= 1;
  }
  return ans;
}
int n;
struct Vec {
  int num[105];
  Vec() { memset(num, 0, sizeof(num)); }
  Vec operator*(long long k) {
    Vec b;
    for (int i = 1; i <= n + 1; i++) b.num[i] = num[i] * k % 1000000007;
    return b;
  }
  Vec operator-(Vec b) {
    Vec c;
    for (int i = 1; i <= n + 1; i++)
      c.num[i] = (num[i] - b.num[i] + 1000000007) % 1000000007;
    return c;
  }
};
Vec aa[105];
int ans[105];
void gause(int n) {
  for (int i = 1; i <= n; i++) {
    if (!aa[i].num[i]) {
      for (int j = i + 1; j <= n; j++)
        if (aa[j].num[i]) {
          swap(aa[i], aa[j]);
          break;
        }
    }
    long long inv = pow_mod(aa[i].num[i], 1000000007 - 2);
    for (int j = i + 1; j <= n; j++)
      for (int k = n + 1; k >= i; k--)
        aa[j].num[k] = (aa[j].num[k] -
                        (long long)aa[i].num[k] * inv % 1000000007 *
                            aa[j].num[i] % 1000000007 +
                        1000000007) %
                       1000000007;
  }
  for (int i = n; i > 0; i--) {
    ans[i] =
        aa[i].num[n + 1] * pow_mod(aa[i].num[i], 1000000007 - 2) % 1000000007;
    for (int j = i - 1; j > 0; j--)
      aa[j].num[n + 1] =
          (aa[j].num[n + 1] - (long long)ans[i] * aa[j].num[i] % 1000000007 +
           1000000007) %
          1000000007;
  }
}
Vec f[105][105];
bool col[105][105], vis[105][105];
int main() {
  int r;
  long long a, b, c, d;
  scanf("%d%lld%lld%lld%lld", &r, &a, &b, &c, &d);
  long long inv = pow_mod(a + b + c + d, 1000000007 - 2);
  a = a * inv % 1000000007;
  b = b * inv % 1000000007;
  c = c * inv % 1000000007;
  d = d * inv % 1000000007;
  n = 2 * r + 1;
  for (int i = -r; i <= r; i++)
    for (int j = -r; j <= r; j++)
      if (i * i + j * j <= r * r) col[i + r + 1][j + r + 1] = 1;
  int sz = 0, cnt = 0;
  long long v = pow_mod(c, 1000000007 - 2);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++)
      if (col[i][j] && !vis[i][j]) f[i][j].num[++sz] = 1;
    for (int j = 1; j <= n; j++)
      if (col[i][j]) {
        if (col[i + 1][j]) {
          f[i + 1][j] =
              f[i][j] - f[i - 1][j] * a - f[i][j - 1] * b - f[i][j + 1] * d;
          f[i + 1][j].num[n + 1] =
              (f[i + 1][j].num[n + 1] - 1LL + 1000000007) % 1000000007;
          f[i + 1][j] = f[i + 1][j] * v;
          vis[i + 1][j] = 1;
        } else {
          Vec t = f[i][j] - f[i - 1][j] * a - f[i][j - 1] * b - f[i][j + 1] * d;
          t.num[n + 1] = (t.num[n + 1] - 1LL + 1000000007) % 1000000007;
          t.num[n + 1] = (1000000007 - t.num[n + 1]) % 1000000007;
          aa[++cnt] = t;
        }
      }
  }
  gause(cnt);
  int s = f[r + 1][r + 1].num[n + 1];
  for (int i = 1; i <= n; i++)
    s = (s + (long long)f[r + 1][r + 1].num[i] * ans[i]) % 1000000007;
  printf("%d\n", s);
  return 0;
}