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;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-12;
const long double pi = acos(-1.0);
long long mod_pow(long long a, long long n, long long m = mod) {
  a %= m;
  long long res = 1;
  while (n) {
    if (n & 1) res = res * a % m;
    a = a * a % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint &a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint &a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
using mat = vector<vector<int>>;
void Gauss_elim(mat &A, int sup, vector<int> &ri) {
  int le = 0;
  int n = A.size();
  int m = A[0].size();
  int r = 0;
  for (int j = 0; j < m - 1; j++) {
    for (int i = le; i < min(n, le + sup); i++) {
      if (A[i][j] != (modint)0) {
        swap(A[i], A[le]);
        swap(ri[i], ri[le]);
        r = max(r, ri[le]);
        for (int k = le; k < min(n, le + sup); k++) {
          if (k == le) continue;
          if (A[k][j] == 0) continue;
          int c = (long long)A[k][j] * mod_pow(A[le][j], mod - 2) % mod;
          for (int l = j; l < r + 1; l++) {
            A[k][l] -= (long long)A[le][l] * c % mod;
            if (A[k][l] < 0) A[k][l] += mod;
          }
          A[k].back() -= (long long)A[le].back() * c % mod;
          if (A[k].back() < 0) A[k].back() += mod;
        }
        int c = mod_pow(A[le][j], mod - 2);
        for (int l = j; l < m; l++) {
          A[le][l] = (long long)A[le][l] * c % mod;
        }
        le++;
        break;
      }
    }
  }
}
void solve() {
  int r;
  cin >> r;
  int pd[4];
  int a[4];
  for (int i = 0; i < 4; i++) cin >> a[i];
  int sum = a[0] + a[1] + a[2] + a[3];
  int invsum = mod_pow(sum, mod - 2);
  pd[0] = (long long)a[3] * invsum % mod;
  pd[1] = (long long)a[2] * invsum % mod;
  pd[2] = (long long)a[1] * invsum % mod;
  pd[3] = (long long)a[0] * invsum % mod;
  map<pair<int, int>, int> mp;
  int tmp = 0;
  for (int x = -50; x <= 50; x++) {
    for (int y = -50; y <= 50; y++) {
      int d = x * x + y * y;
      if (d <= r * r) {
        mp[{x, y}] = tmp;
        tmp++;
      }
    }
  }
  mat A(tmp, vector<int>(tmp + 1, (modint)0));
  vector<int> ri(tmp);
  for (int x = -50; x <= 50; x++) {
    for (int y = -50; y <= 50; y++) {
      int d = x * x + y * y;
      if (d <= r * r) {
        int id = mp[{x, y}];
        A[id].back() = mod - 1;
        A[id][id] = 1;
        ri[id] = id;
        for (int d = 0; d < 4; d++) {
          int nx = x + dx[d], ny = y + dy[d];
          if (mp.find({nx, ny}) != mp.end()) {
            int to = mp[{nx, ny}];
            A[id][to] = mod - pd[d];
            ri[id] = max(ri[id], to);
          }
        }
      }
    }
  }
  Gauss_elim(A, 105, ri);
  vector<int> ex(tmp);
  for (int i = tmp - 1; i >= 0; i--) {
    for (int j = i + 1; j < min(tmp, i + 105); j++) {
      ex[i] -= (long long)ex[j] * A[i][j] % mod;
      if (ex[i] < 0) ex[i] += mod;
    }
    ex[i] -= A[i].back();
    if (ex[i] < 0) ex[i] += mod;
  }
  cout << ex[mp[{0, 0}]] << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  char nyaa;
  cin >> nyaa;
  return 0;
}
