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>
const int M = 7851, mod = 1e9 + 7;
int n, r, a, b, c, d, tot, len, X[M], G[M][M];
struct Pair {
  int x, y;
  inline bool operator<(const Pair& it) const {
    return x == it.x ? y < it.y : x < it.x;
  }
} p[20005];
inline void swap(int& a, int& b) {
  int c = a;
  a = b;
  b = c;
}
inline int min(const int& a, const int& b) { return a > b ? b : a; }
inline int max(const int& a, const int& b) { return a > b ? a : b; }
inline int Add(const int& a, const int& b) {
  return a + b >= mod ? a + b - mod : a + b;
}
inline int Del(const int& a, const int& b) {
  return b > a ? a - b + mod : a - b;
}
inline int pow(int a, int b = mod - 2) {
  int ans = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) ans = 1ll * ans * a % mod;
  return ans;
}
inline void Gauss(const int& n, const int& len) {
  register int i, j, k, d, inv, lim1, lim2;
  for (i = 1; i <= n; ++i) {
    lim1 = min(n, i + len);
    lim2 = min(n, i + len * 2);
    if (!G[i][i]) {
      for (j = i + 1; j <= lim1; ++j) {
        if (G[j][i]) {
          for (k = i; k <= lim2; ++k) swap(G[i][k], G[j][k]);
          swap(X[i], X[j]);
          break;
        }
      }
    }
    if (!G[i][i]) continue;
    inv = pow(G[i][i]);
    for (j = i + 1; j <= lim1; ++j) {
      d = 1ll * G[j][i] * inv % mod;
      for (k = i; k <= lim2; ++k)
        G[j][k] = Del(G[j][k], 1ll * G[i][k] * d % mod);
      X[j] = Del(X[j], 1ll * X[i] * d % mod);
    }
  }
  for (i = n; i >= 1; --i) {
    lim2 = min(n, i + len * 2);
    for (j = i + 1; j <= lim2; ++j)
      X[i] = Del(X[i], 1ll * X[j] * G[i][j] % mod);
    X[i] = 1ll * X[i] * pow(G[i][i]) % mod;
  }
}
inline int get(const int& x, const int& y) {
  return std::lower_bound(p + 1, p + tot + 1, (Pair){x, y}) - p;
}
signed main() {
  register int i, j, x, y;
  scanf("%d%d%d%d%d", &r, &a, &b, &c, &d);
  x = pow(a + b + c + d);
  a = 1ll * a * x % mod;
  b = 1ll * b * x % mod;
  c = 1ll * c * x % mod;
  d = 1ll * d * x % mod;
  for (i = -r; i <= r; ++i) {
    for (j = -r; j <= r; ++j) {
      if (i * i + j * j <= r * r) p[++tot] = (Pair){i, j};
    }
  }
  for (i = 1; i <= tot; ++i) {
    G[i][i] = 1;
    X[i] = 1;
    x = p[i].x + 1;
    y = p[i].y;
    if (x * x + y * y <= r * r)
      G[i][j = get(x, y)] = mod - a, len = max(len, j > i ? j - i : i - j);
    x = p[i].x;
    y = p[i].y + 1;
    if (x * x + y * y <= r * r)
      G[i][j = get(x, y)] = mod - b, len = max(len, j > i ? j - i : i - j);
    x = p[i].x - 1;
    y = p[i].y;
    if (x * x + y * y <= r * r)
      G[i][j = get(x, y)] = mod - c, len = max(len, j > i ? j - i : i - j);
    x = p[i].x;
    y = p[i].y - 1;
    if (x * x + y * y <= r * r)
      G[i][j = get(x, y)] = mod - d, len = max(len, j > i ? j - i : i - j);
  }
  Gauss(tot, len);
  printf("%d", X[get(0, 0)]);
}