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 gi() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - 48;
    ch = getchar();
  }
  return x * f;
}
template <typename T>
inline void Max(T &a, T b) {
  if (a < b) a = b;
}
template <typename T>
inline void Min(T &a, T b) {
  if (a > b) a = b;
}
const int N = 110, mod = 1e9 + 7;
int ndc, n = 102;
int id[N][N], G[8000][8000], dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
long long p[4], R;
long long Pow(long long a, long long b) {
  a %= mod;
  long long res = 1ll;
  for (; b; b >>= 1, a = a * a % mod)
    if (b & 1) res = res * a % mod;
  return res;
}
long long Inv(long long a) { return Pow(a, mod - 2); }
long long sqr(int x) { return 1ll * x * x; }
void Gauss(int n, int m) {
  for (int u = 1, col = 1; col <= m; ++u, ++col) {
    int sel = u;
    for (; sel <= n && !G[sel][col]; ++sel)
      ;
    if (sel > n) {
      --u;
      continue;
    }
    if (sel ^ u) {
      for (int i = col; i <= m + 1; ++i) swap(G[u][i], G[sel][i]);
    }
    long long inv = Inv(G[u][col]);
    for (int i = col; i <= min(m, col + 104); ++i)
      G[u][i] = (long long)G[u][i] * inv % mod;
    G[u][m + 1] = (long long)G[u][m + 1] * inv % mod;
    for (int v = u + 1; v <= min(n, u + 104); ++v)
      if (u ^ v) {
        int val = G[v][col];
        for (int i = col; i <= min(m, col + 104); ++i)
          G[v][i] = (G[v][i] - (long long)G[u][i] * val % mod + mod) % mod;
        G[v][m + 1] =
            (G[v][m + 1] - (long long)G[u][m + 1] * val % mod + mod) % mod;
      }
  }
  for (int i = n; i; --i) {
    for (int j = i + 1; j <= n; ++j)
      G[i][m + 1] =
          (G[i][m + 1] - (long long)G[i][j] * G[j][m + 1] % mod + mod) % mod;
  }
}
int main() {
  R = gi(), p[0] = gi(), p[1] = gi(), p[2] = gi(), p[3] = gi();
  long long inv = Inv(p[0] + p[1] + p[2] + p[3]);
  for (int i = 0; i <= 3; ++i) p[i] = p[i] * inv % mod;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (sqr(51 - i) + sqr(51 - j) <= R * R) id[i][j] = ++ndc;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (sqr(51 - i) + sqr(51 - j) <= R * R) {
        int t = id[i][j];
        for (int d = 0; d < 4; ++d) {
          int tx = i + dx[d], ty = j + dy[d];
          if (sqr(51 - tx) + sqr(51 - ty) <= R * R)
            G[t][id[tx][ty]] = mod - p[d];
        }
        G[t][ndc + 1] = 1;
        G[t][t] = 1;
      }
  Gauss(ndc, ndc);
  printf("%d\n", G[id[51][51]][ndc + 1]);
  return 0;
}
