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;
namespace RA {
int r(int p) { return 1ll * rand() * rand() % p; }
int r(int L, int R) { return r(R - L + 1) + L; }
}  // namespace RA
const int P = 1e9 + 7, SZ = 11000, SSZ = 110;
struct equation {
  int c[SSZ] = {};
  int& operator[](int x) { return c[x]; }
  equation operator+(equation e) {
    equation res;
    for (int i = (0); i <= (SSZ - 1); ++i) res[i] = (c[i] + e[i]) % P;
    return res;
  }
  equation operator-(equation e) {
    equation res;
    for (int i = (0); i <= (SSZ - 1); ++i) res[i] = (c[i] - e[i] + P) % P;
    return res;
  }
  equation operator-=(equation e) { return *this = *this - e, *this; }
  equation operator-(int x) {
    equation res = *this;
    res[0] = (res[0] - 1 + P) % P;
    return res;
  }
  equation operator*(int x) {
    equation res = *this;
    for (int i = (0); i <= (SSZ - 1); ++i)
      if (res[i]) res[i] = res[i] * 1ll * x % P;
    return res;
  }
  equation operator*=(int x) { return *this = *this * x, *this; }
} EQ[SZ], G[SZ];
int lg;
int pw(int a, int m) {
  int res = 1;
  while (m) m& 1 ? res = 1ll * res * a % P : 0, a = 1ll * a * a % P, m >>= 1;
  return res;
}
int R, a[5], p[5];
inline int I(int x, int y) { return x += R, y += R, x * (2 * R + 1) + y; }
inline equation& F(int x, int y) { return EQ[I(x, y)]; }
bool check(int x, int y) { return x * x + y * y <= R * R; }
int tot;
void calc_main(int x, int y) {
  if (!check(x, y)) return;
  if (!check(x - 1, y)) {
    F(x, y)[++tot] = 1;
  }
}
void work(int x, int y) {
  if (!check(x, y)) return;
  F(x + 1, y) = F(x, y) - 1;
  if (check(x - 1, y)) F(x + 1, y) -= F(x - 1, y) * p[1];
  if (check(x, y - 1)) F(x + 1, y) -= F(x, y - 1) * p[2];
  if (check(x, y + 1)) F(x + 1, y) -= F(x, y + 1) * p[4];
  F(x + 1, y) *= pw(p[3], P - 2);
  if (!check(x + 1, y)) {
    G[++lg] = F(x + 1, y);
  }
}
void gauss(equation c[], int n) {
  for (int i = (1); i <= (n); ++i) {
    for (int j = (i); j <= (n); ++j)
      if (c[j][i]) {
        for (int k = (0); k <= (n); ++k) swap(c[j][k], c[i][k]);
        break;
      }
    for (int j = (1); j <= (n); ++j) {
      if (i == j) continue;
      int rate = c[j][i] * 1ll * pw(c[i][i], P - 2) % P;
      for (int k = (i); k <= (n); ++k)
        c[j][k] = (c[j][k] - 1ll * c[i][k] * rate) % P;
      c[j][0] = (c[j][0] - 1ll * c[i][0] * rate) % P;
    }
  }
  for (int i = (1); i <= (n); ++i)
    c[i][0] = c[i][0] * 1ll * pw(c[i][i], P - 2) % P, c[i][i] = 1;
  for (int i = (1); i <= (n); ++i) c[i][0] = (c[i][0] + P) % P;
}
int main() {
  scanf("%d%d%d%d%d", &R, &a[1], &a[2], &a[3], &a[4]);
  int s = a[1] + a[2] + a[3] + a[4];
  s = pw(s, P - 2);
  for (int i = (1); i <= (4); ++i) p[i] = a[i] * 1ll * s % P;
  for (int i = (-R); i <= (R); ++i)
    for (int j = (-R); j <= (R); ++j) {
      calc_main(i, j);
    }
  for (int i = (-R); i <= (R); ++i)
    for (int j = (-R); j <= (R); ++j) {
      work(i, j);
    }
  assert(lg == R * 2 + 1);
  for (int i = (1); i <= (lg); ++i) G[i][0] = P - G[i][0];
  gauss(G, lg);
  int A[SZ], ans = F(0, 0)[0];
  for (int i = (1); i <= (lg); ++i) A[i] = G[i][0];
  for (int i = (1); i <= (lg); ++i) ans = (ans + F(0, 0)[i] * 1ll * A[i]) % P;
  printf("%d\n", ans);
  return 0;
}