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;
int mat[7905][7905], vecr[7905];
long long R, n, p[4];
long long modpow(long long x, long long n) {
  x = (x % 1000000007 + 1000000007) % 1000000007;
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    n >>= 1;
  }
  return res;
}
vector<long long> gauss_band(int B) {
  for (int j = 0; j < n; j++) {
    int pivot = -1;
    for (int i = j; i < min((int)n, j + B + 3); i++) {
      if (mat[i][j]) {
        pivot = i;
        break;
      }
    }
    if (pivot == -1) continue;
    for (int g = j; g < min((int)n, j + 2 * B + 3); g++)
      swap(mat[j][g], mat[pivot][g]);
    swap(vecr[j], vecr[pivot]);
    long long rev = modpow(1LL * mat[j][j], 1000000007 - 2);
    int en = -1;
    for (int i = min((int)n, j + 2 * B + 3) - 1; i >= j; i--)
      if (mat[j][i]) {
        en = i;
        break;
      }
    assert(en >= j);
    for (int i = j + 1; i < min((int)n, j + B + 3); i++) {
      if (mat[i][j]) {
        long long gg = 1LL * mat[i][j] * rev % 1000000007;
        vecr[i] -= 1LL * vecr[j] * gg % 1000000007;
        if (vecr[i] < 0) vecr[i] += 1000000007;
        for (int g = j; g <= en; g++) {
          mat[i][g] -= 1LL * mat[j][g] * gg % 1000000007;
          if (mat[i][g] < 0) mat[i][g] += 1000000007;
        }
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (mat[i][i] == 0) continue;
    long long rev = modpow(1LL * mat[i][i], 1000000007 - 2);
    for (int j = i - 1; j >= max(0, i - 2 * B - 3); j--) {
      if (mat[j][i]) {
        vecr[j] -= 1LL * vecr[i] * rev % 1000000007 * mat[j][i] % 1000000007;
        if (vecr[j] < 0) vecr[j] += 1000000007;
        mat[j][i] = 0;
      }
    }
  }
  vector<long long> ans;
  for (int i = 0; i < n; i++)
    ans.push_back((1LL * vecr[i] % 1000000007 + 1000000007) % 1000000007 *
                  modpow(1LL * mat[i][i], 1000000007 - 2) % 1000000007);
  return ans;
}
int target, nxt;
map<pair<int, int>, int> M;
vector<pair<int, int> > vec;
int main() {
  cin >> R >> p[0] >> p[1] >> p[2] >> p[3];
  long long rev = modpow(p[0] + p[1] + p[2] + p[3], 1000000007 - 2);
  for (int h = 0; h < 4; h++) p[h] = p[h] * rev % 1000000007;
  for (int i = -R; i <= R; i++)
    for (int j = -R; j <= R; j++) {
      if (i * i + j * j <= R * R) {
        vec.push_back(make_pair(i, j));
        M[make_pair(i, j)] = vec.size() - 1;
        if (i == 0 && j == 0) target = vec.size() - 1;
      }
    }
  n = vec.size();
  int dx[4] = {-1, 0, 1, 0};
  int dy[4] = {0, -1, 0, 1};
  for (int i = -R; i <= R; i++)
    for (int j = -R; j <= R; j++) {
      if (i * i + j * j <= R * R) {
        for (int k = 0; k < 4; k++) {
          int nx = i + dx[k], ny = j + dy[k];
          if (nx * nx + ny * ny <= R * R) {
            mat[M[make_pair(i, j)]][M[make_pair(nx, ny)]] = 1000000007 - p[k];
          }
        }
        mat[M[make_pair(i, j)]][M[make_pair(i, j)]] = 1;
        vecr[M[make_pair(i, j)]] = 1;
      }
    }
  vector<long long> ret = gauss_band(105);
  cout << ret[target] << endl;
}