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 maxn = 55;
const int mod = 1e9 + 7;
int r, n, p1, p2, p3, p4, p[maxn * 2];
int a[maxn * 2][maxn * 2];
class Func {
 public:
  int coef[maxn * 2];
  Func() {
    for (int i = 0; i < (n + 1); i++) coef[i] = 0;
  }
  Func operator+(const Func &o) const {
    Func res;
    for (int i = 0; i < (n + 1); i++) {
      res.coef[i] = coef[i] + o.coef[i];
      if (res.coef[i] >= mod) res.coef[i] -= mod;
    }
    return res;
  }
  Func operator-(const Func &o) const {
    Func res;
    for (int i = 0; i < (n + 1); i++) {
      res.coef[i] = coef[i] - o.coef[i];
      if (res.coef[i] < 0) res.coef[i] += mod;
    }
    return res;
  }
  Func operator*(const int &x) const {
    Func res;
    for (int i = 0; i < (n + 1); i++) res.coef[i] = 1LL * coef[i] * x % mod;
    return res;
  }
} f[maxn * 2][maxn * 2];
int quickpow(int x, int pow) {
  int res = 1;
  for (; pow; pow >>= 1) {
    if (pow & 1) res = 1LL * res * x % mod;
    x = 1LL * x * x % mod;
  }
  return res;
}
void gauss() {
  for (int i = 0; i < (n); i++) {
    int j = i;
    while (j < n && !a[j][i]) j++;
    for (int k = 0; k < (n + 1); k++) swap(a[i][k], a[j][k]);
    int inv = quickpow(a[i][i], mod - 2);
    for (int j = 0; j < (n); j++)
      if (j != i && a[j][i]) {
        for (int k = i + 1; k <= n; k++) {
          a[j][k] -= 1LL * a[i][k] * inv % mod * a[j][i] % mod;
          if (a[j][k] < 0) a[j][k] += mod;
        }
        a[j][i] = 0;
      }
  }
}
int main() {
  scanf("%d%d%d%d%d", &r, &p1, &p2, &p3, &p4);
  n = 2 * r + 1;
  int inv = quickpow(p1 + p2 + p3 + p4, mod - 2);
  p1 = 1LL * p1 * inv % mod;
  p2 = 1LL * p2 * inv % mod;
  p3 = 1LL * p3 * inv % mod;
  p4 = 1LL * p4 * inv % mod;
  for (int j = -r; j <= r; j++) {
    for (int i = -r; i <= r; i++)
      if (i * i + j * j <= r * r) {
        p[j + r] = i;
        break;
      }
    f[p[j + r] + r][j + r].coef[j + r] = 1;
  }
  for (int i = -r; i <= r; i++) {
    for (int j = -r; j <= r; j++) {
      if (i * i + j * j > r * r) continue;
      f[i + 1 + r][j + r] = f[i + r][j + r];
      f[i + 1 + r][j + r].coef[n]--;
      if (f[i + 1 + r][j + r].coef[n] < 0) f[i + 1 + r][j + r].coef[n] += mod;
      if ((i - 1) * (i - 1) + j * j <= r * r)
        f[i + 1 + r][j + r] = f[i + 1 + r][j + r] - f[i - 1 + r][j + r] * p1;
      if (i * i + (j - 1) * (j - 1) <= r * r)
        f[i + 1 + r][j + r] = f[i + 1 + r][j + r] - f[i + r][j - 1 + r] * p2;
      if (i * i + (j + 1) * (j + 1) <= r * r)
        f[i + 1 + r][j + r] = f[i + 1 + r][j + r] - f[i + r][j + 1 + r] * p4;
      f[i + 1 + r][j + r] = f[i + 1 + r][j + r] * quickpow(p3, mod - 2);
      if ((i + 1) * (i + 1) + j * j > r * r) {
        for (int k = 0; k < (n); k++) a[j + r][k] = f[i + 1 + r][j + r].coef[k];
        a[j + r][n] = mod - f[i + 1 + r][j + r].coef[n];
        if (a[j + r][n] >= mod) a[j + r][n] -= mod;
      }
    }
  }
  gauss();
  int ans = f[r][r].coef[n];
  for (int i = 0; i < (n); i++) {
    ans += 1LL * f[r][r].coef[i] * a[i][n] % mod * quickpow(a[i][i], mod - 2) %
           mod;
    if (ans >= mod) ans -= mod;
  }
  printf("%d\n", ans);
  return 0;
}
