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;
const int MAX = 18100;
const int INF = 1000000000;
const long long MOD = 1000000007;
long long mod(long long a, long long b, long long m) {
  long long ret = 1;
  a %= m;
  while (b) {
    if (b & 1) ret = ret * a % m;
    b >>= 1;
    a = a * a % m;
  }
  return ret;
}
long long inv(long long a) { return mod(a, MOD - 2, MOD); }
vector<pair<long long, long long> > p;
map<pair<long long, long long>, long long> ind;
long long vabs(long long x) { return x > 0 ? x : -x; }
long long sqr(long long x) { return x * x; }
long long mhd(pair<long long, long long> pt) {
  return vabs(pt.first) + vabs(pt.second);
}
bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
  return mhd(a) > mhd(b);
}
long long dir[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
long long cof[4] = {0};
vector<pair<long long, long long> > sbj[MAX];
bool inCircle(long long x, long long y, long long R) {
  return x * x + y * y <= R * R;
}
void buildFormular(long long idx, pair<long long, long long> center,
                   long long R) {
  sbj[idx].clear();
  for (long long i = 0; i < 4; i++) {
    long long tx = center.first + dir[i][0];
    long long ty = center.second + dir[i][1];
    if (inCircle(tx, ty, R)) {
      sbj[idx].push_back(make_pair(ind[make_pair(tx, ty)], cof[i]));
    }
  }
  sbj[idx].push_back(make_pair(-1L, 1));
}
const long long MSIZE = 256;
long long ml[MSIZE][MSIZE];
long long mr[MSIZE][MSIZE];
void clr(long long mat[MSIZE][MSIZE], long long n, long long m) {
  long long i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      mat[i][j] = 0;
    }
  }
}
void mod(long long mat[MSIZE][MSIZE], long long n, long long m) {
  long long i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (mat[i][j] != 0) mat[i][j] %= MOD;
    }
  }
}
long long findRow(long long mat[MSIZE][MSIZE], long long col, long long n) {
  for (long long i = col; i < n; i++) {
    if (mat[i][col] != 0) return i;
  }
  return -1;
}
void swapRow(long long mat[MSIZE][MSIZE], long long r1, long long r2,
             long long st, long long len) {
  for (long long i = st; i < len; i++) {
    swap(mat[r1][i], mat[r2][i]);
  }
}
void mulRow(long long mat[MSIZE][MSIZE], long long r, long long st,
            long long len, long long d) {
  for (long long i = st; i < len; i++) {
    if (mat[r][i] != 0) {
      mat[r][i] = mat[r][i] * d % MOD;
    }
  }
}
void minusRow(long long mat[MSIZE][MSIZE], long long r1, long long r2,
              long long st, long long len, long long d) {
  for (long long i = st; i < len; i++) {
    if (mat[r1][i] != 0) {
      mat[r2][i] = (mat[r2][i] - d * mat[r1][i]) % MOD;
    }
  }
}
void gauss(long long ml[MSIZE][MSIZE], long long mr[MSIZE][MSIZE], long long n,
           long long m) {
  long long i, j, k;
  for (i = 0; i < n; i++) {
    long long r = findRow(ml, i, n);
    if (i != r) {
      swapRow(ml, i, r, i, n);
      swapRow(mr, i, r, 0, m);
    }
    long long d = ml[i][i];
    if (d != 1) {
      d = inv(d);
      mulRow(ml, i, i, n, d);
      mulRow(mr, i, 0, m, d);
    }
    for (j = i + 1; j < n; j++) {
      if (ml[j][i] == 0) continue;
      d = ml[j][i];
      minusRow(ml, i, j, i, n, d);
      minusRow(mr, i, j, 0, m, d);
    }
  }
  for (i = n - 1; i >= 0; i--) {
    for (j = i - 1; j >= 0; j--) {
      if (ml[j][i] == 0) continue;
      long long d = ml[j][i];
      minusRow(ml, i, j, i, n, d);
      minusRow(mr, i, j, 0, m, d);
    }
  }
}
long long cut[MAX];
int main() {
  long long R, a1, a2, a3, a4;
  cin >> R >> a1 >> a2 >> a3 >> a4;
  if (R == 0) {
    puts("1");
    return 0;
  }
  long long tot = inv(a1 + a2 + a3 + a4);
  cof[0] = a1 * tot % MOD;
  cof[1] = a2 * tot % MOD;
  cof[2] = a3 * tot % MOD;
  cof[3] = a4 * tot % MOD;
  long long i, j, k;
  p.clear();
  ind.clear();
  long long maxMHD = 0;
  for (i = -R; i <= R; i++) {
    for (j = -R; j <= R; j++) {
      if (inCircle(i, j, R)) {
        p.push_back(make_pair(i, j));
      }
    }
  }
  sort(p.begin(), p.end(), cmp);
  maxMHD = mhd(p[0]);
  for (i = 0; i < p.size(); i++) {
    ind[p[i]] = i;
  }
  for (i = 0; i < p.size(); i++) {
    buildFormular(i, p[i], R);
  }
  R = maxMHD;
  cut[R] = 0;
  long long dis;
  for (dis = R - 1; dis >= 0; dis--) {
    cut[dis] = cut[dis + 1];
    while (cut[dis] < p.size() && mhd(p[cut[dis]]) != dis) {
      cut[dis]++;
    }
  }
  clock_t st = clock();
  for (dis = R; dis > 0; dis--) {
    long long sizel = -cut[dis - 1];
    long long r2 = 0;
    if (dis - 2 >= 0) {
      sizel += cut[dis - 2];
      r2 = cut[dis - 2];
    } else {
      sizel += p.size();
      r2 = p.size();
    }
    long long sizer = 0;
    if (dis - 2 >= 0) {
      sizer -= cut[dis - 2];
      if (dis - 3 >= 0) {
        sizer += cut[dis - 3];
      } else {
        sizer += p.size();
      }
    }
    sizer++;
    clr(ml, sizel, sizel);
    clr(mr, sizel, sizer);
    long long start1 = cut[dis - 1];
    long long start2 = 0;
    if (dis - 2 >= 0) {
      start2 = cut[dis - 2];
    }
    for (i = cut[dis - 1]; i < p.size() && mhd(p[i]) == dis - 1; i++) {
      long long mainx = i - start1;
      ml[mainx][mainx]++;
      for (j = 0; j < sbj[i].size(); j++) {
        if (sbj[i][j].first == -1) {
          mr[mainx][sizer - 1] += sbj[i][j].second;
        } else {
          long long commonCof = 0;
          if (sbj[i][j].first < start1) {
            commonCof = sbj[i][j].second;
            long long x = sbj[i][j].first;
            for (k = 0; k < sbj[x].size(); k++) {
              long long der = sbj[x][k].second * commonCof % MOD;
              if (sbj[x][k].first == -1) {
                mr[mainx][sizer - 1] += der;
              } else if (sbj[x][k].first < r2) {
                ml[mainx][sbj[x][k].first - start1] -= der;
              } else {
                mr[mainx][sbj[x][k].first - start2] += der;
              }
            }
          } else if (sbj[i][j].first < r2) {
            ml[mainx][sbj[i][j].first - start1] -= sbj[i][j].second;
          } else {
            mr[mainx][sbj[i][j].first - start2] += sbj[i][j].second;
          }
        }
      }
    }
    mod(ml, sizel, sizel);
    mod(mr, sizel, sizer);
    gauss(ml, mr, sizel, sizer);
    for (i = 0; i < sizel; i++) {
      sbj[i + start1].clear();
      for (j = 0; j < sizer - 1; j++) {
        sbj[i + start1].push_back(make_pair(j + start2, mr[i][j]));
      }
      sbj[i + start1].push_back(make_pair(-1L, mr[i][j]));
    }
  }
  clock_t et = clock();
  long long ans = sbj[p.size() - 1].back().second;
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}