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 N = 7850;
const int mo = 1e9 + 7;
const int dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
int n, p[10], sump, tot, ma[N][N], dao, ans[N], dui[N << 1];
pair<int, int> ji[N];
inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline int fix(int x) {
  if (x >= mo) return x - mo;
  return x < 0 ? x + mo : x;
}
inline int hapow(int x, int y) {
  int daan = 1;
  while (y) {
    if (y & 1) daan = 1ll * daan * x % mo;
    x = 1ll * x * x % mo;
    y >>= 1;
  }
  return daan;
}
inline int suan(int x, int y) { return (x + n) * (n * 2 + 1) + y + n; }
inline void Guass() {
  for (int i = 1, op = 1; i <= tot; i++, op++) {
    int you = 0;
    for (int j = op; j <= tot; j++)
      if (ma[i][j]) {
        you = j;
        break;
      }
    if (you == 0) {
      op--;
      continue;
    }
    for (int j = i; j <= tot; j++) swap(ma[j][op], ma[j][you]);
    int hu = hapow(ma[i][op], mo - 2);
    for (int j = op; j <= op + dao && j <= tot; j++)
      ma[i][j] = 1ll * ma[i][j] * hu % mo;
    ma[i][tot + 1] = 1ll * ma[i][tot + 1] * hu % mo;
    for (int j = i + 1; j <= i + dao && j <= tot; j++)
      if (ma[j][op]) {
        int hu = ma[j][op];
        ma[j][tot + 1] = fix(ma[j][tot + 1] - 1ll * hu * ma[i][tot + 1] % mo);
        for (int k = op; k <= op + dao && k <= tot; k++)
          ma[j][k] = fix(ma[j][k] - 1ll * hu * ma[i][k] % mo);
      }
  }
  for (int i = tot; i >= 1; i--) {
    int hu = 0;
    for (int j = 1; j <= tot; j++)
      if (ma[i][j] == 1) {
        hu = j;
        break;
      }
    if (!hu) continue;
    ans[hu] = ma[i][tot + 1];
    for (int j = i - 1; j >= 1; j--)
      ma[j][tot + 1] = fix(ma[j][tot + 1] - 1ll * ans[hu] * ma[j][hu] % mo),
                  ma[j][hu] = 0;
  }
}
int main() {
  n = read();
  for (int i = 0; i <= 3; i++) p[i] = read(), sump = fix(sump + p[i]);
  sump = hapow(sump, mo - 2);
  for (int i = 0; i <= 3; i++) p[i] = 1ll * p[i] * sump % mo;
  for (int i = -n; i <= n; i++)
    for (int j = -n; j <= n; j++) {
      if (i * i + j * j <= n * n) {
        ji[++tot] = make_pair(i, j);
        dui[suan(i, j)] = tot;
      }
    }
  for (int i = 1; i <= tot; i++) {
    int nx = ji[i].first, ny = ji[i].second;
    ma[i][i] = 1;
    ma[i][tot + 1] = 1;
    for (int j = 0; j <= 3; j++) {
      int dx = nx + dir[j][0], dy = ny + dir[j][1];
      if (dx * dx + dy * dy <= n * n) {
        ma[i][dui[suan(dx, dy)]] = fix(-p[j]);
        dao = max(dao, abs(i - dui[suan(dx, dy)]));
      }
    }
  }
  Guass();
  cout << ans[dui[suan(0, 0)]];
  return 0;
}
