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;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MOD = 1000000007;
const int MAXR = 50;
const int MAXP = 7845;
const int MAXV = 2 * MAXR + 1;
const int DX[] = {-1, 0, +1, 0}, DY[] = {0, +1, 0, -1};
int pw(int x, int n) {
  int ret = 1;
  while (true) {
    if (n & 1) ret = (long long)ret * x % MOD;
    if ((n >>= 1) == 0) return ret;
    x = (long long)x * x % MOD;
  }
}
int inv(int x) { return pw(x, MOD - 2); }
int R, a1, a2, a3, a4;
int pup, plt, prt, pdn;
int prob[4];
map<pair<int, int>, int> mp;
vector<pair<int, int> > p;
int nv;
bool done[MAXP];
int eq[MAXP][MAXV];
int eqcnst[MAXP];
int cur[MAXV];
int curcnst;
int curdnid;
void run() {
  scanf("%d%d%d%d%d", &R, &a1, &a2, &a3, &a4);
  int pinv = inv(a1 + a2 + a3 + a4);
  plt = (long long)a1 * pinv % MOD, pdn = (long long)a2 * pinv % MOD,
  prt = (long long)a3 * pinv % MOD, pup = (long long)a4 * pinv % MOD;
  prob[0] = plt, prob[1] = pup, prob[2] = prt, prob[3] = pdn;
  p.clear();
  for (int y = R; y >= -R; --y)
    for (int x = (-R); x <= (+R); ++x)
      if (x * x + y * y <= R * R)
        mp[make_pair(x, y)] = ((int)(p).size()), p.push_back(make_pair(x, y));
  nv = 2 * R + 1;
  for (int i = (0); i < (((int)(p).size())); ++i) done[i] = false;
  for (int y = R; y >= -R; --y)
    for (int x = (-R); x <= (+R); ++x)
      if (x * x + y * y <= R * R) {
        int id = mp[make_pair(x, y)];
        for (int j = (0); j < (nv); ++j) cur[j] = 0;
        curcnst = 1;
        curdnid = -1;
        for (int k = (0); k < (4); ++k) {
          int nx = x + DX[k], ny = y + DY[k], nid = -1;
          if (mp.count(make_pair(nx, ny))) nid = mp[make_pair(nx, ny)];
          if (nid == -1) continue;
          if (ny < y) {
            curdnid = nid;
            continue;
          }
          if (nx > x) {
            cur[nx + R] = (cur[nx + R] + prob[k]) % MOD;
            continue;
          }
          for (int j = (0); j < (nv); ++j)
            cur[j] = (cur[j] + (long long)prob[k] * eq[nid][j]) % MOD;
          curcnst = (curcnst + (long long)prob[k] * eqcnst[nid]) % MOD;
        }
        int v = x + R;
        int vmlt = inv((1 + MOD - cur[v]) % MOD);
        cur[v] = curdnid == -1 ? 0 : prob[3];
        for (int j = (0); j < (nv); ++j)
          cur[j] = (long long)cur[j] * vmlt % MOD;
        curcnst = (long long)curcnst * vmlt % MOD;
        for (int pv = (0); pv < (nv); ++pv)
          if (pv != v) {
            int py = pv < v ? y : y + 1, px = pv - R, pid = -1;
            if (mp.count(make_pair(px, py)))
              pid = mp[make_pair(px, py)];
            else
              continue;
            assert(done[pid]);
            int mlt = eq[pid][v];
            eq[pid][v] = 0;
            for (int j = (0); j < (nv); ++j)
              eq[pid][j] = (eq[pid][j] + (long long)cur[j] * mlt) % MOD;
            eqcnst[pid] = (eqcnst[pid] + (long long)curcnst * mlt) % MOD;
          }
        done[id] = true;
        for (int j = (0); j < (nv); ++j) eq[id][j] = cur[j];
        eqcnst[id] = curcnst;
      }
  for (int y = (-R); y <= (+R); ++y)
    for (int x = R; x >= -R; --x)
      if (x * x + y * y <= R * R) {
        int id = mp[make_pair(x, y)], v = x + R;
        for (int pv = (0); pv < (nv); ++pv) {
          int ny = pv < v ? y - 2 : y - 1, nx = pv - R, nid = -1;
          if (mp.count(make_pair(nx, ny)))
            nid = mp[make_pair(nx, ny)];
          else
            continue;
          int mlt = eq[id][pv];
          eq[id][pv] = 0;
          eqcnst[id] = (eqcnst[id] + (long long)mlt * eqcnst[nid]) % MOD;
        }
      }
  printf("%d\n", eqcnst[mp[make_pair(0, 0)]]);
}
int main() {
  run();
  return 0;
}