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>
#pragma GCC optimize "-O3"
using ll = long long;
using ld = long double;
using ull = uint64_t;
using namespace std;
vector<pair<int, int>> pts;
const int MAXN = 7845;
const int MOD = 1e9 + 7;
ll pw(ll a, ll b = MOD - 2) {
  if (!b) {
    return 1;
  }
  ll v = pw(a, b / 2);
  v = (v * v) % MOD;
  if (b & 1) {
    v = (v * a) % MOD;
  }
  return v;
}
int f[MAXN][MAXN + 1];
ll rev[MAXN];
ll ans[MAXN];
int n;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
int p[4];
int r;
bool g(int x, int y) { return x * x + y * y <= r * r; }
int gtid(int nx, int ny) {
  pair<int, int> p{nx, ny};
  int id = lower_bound(pts.begin(), pts.end(), p) - pts.begin();
  return id;
}
const int MV = 102;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  cin >> r;
  ll s = 0;
  for (int& x : p) {
    cin >> x;
    s += x;
  }
  s = pw(s, MOD - 2);
  for (int& x : p) {
    x = (s * x) % MOD;
  }
  for (int i = -r; i <= r; ++i) {
    for (int j = -r; j <= r; ++j) {
      if (g(i, j)) {
        pts.emplace_back(i, j);
      }
    }
  }
  n = pts.size();
  for (int i = 0; i < n; ++i) {
    f[i][i] = 1;
    f[i][n] = 1;
    int x = pts[i].first, y = pts[i].second;
    for (int j = 0; j < 4; ++j) {
      int nx = x + dx[j], ny = y + dy[j];
      if (g(nx, ny)) {
        int id = gtid(nx, ny);
        f[i][id] = -p[j];
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    assert(f[i][i]);
    vector<int> ids = {n};
    int rg = min(n, i + MV);
    for (int j = i; j < rg; ++j) {
      ids.push_back(j);
    }
    rev[i] = pw(f[i][i]);
    for (int j = i + 1; j < rg; ++j) {
      ll cmul = f[j][i] * rev[i] % MOD;
      if (!cmul) {
        continue;
      }
      for (int id : ids) {
        f[j][id] = (f[j][id] - f[i][id] * cmul) % MOD;
      }
    }
  }
  for (int i = n - 1; i >= 0; --i) {
    ll cf = f[i][n];
    int rg = min(n, i + MV);
    for (int j = i + 1; j < rg; ++j) {
      cf = (cf - ans[j] * f[i][j]) % MOD;
    }
    ans[i] = cf * rev[i] % MOD;
  }
  int id = gtid(0, 0);
  if (ans[id] < 0) {
    ans[id] += MOD;
  }
  cout << ans[id] << "\n";
}