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 n, w1, w2, w3, w4, tot, m, i, j, k, a[7855][7855], id1[105][105], f[7855],
    cnt, mod = 1e9 + 7;
void inc(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
void dec(int &x, int y) {
  x -= y;
  if (x < 0) x += mod;
}
int qp(int x, int y) {
  int z = 1;
  while (y) {
    if (y & 1) z = 1ll * z * x % mod;
    x = 1ll * x * x % mod;
    y /= 2;
  }
  return z;
}
int id(int x, int y) {
  if (x * x + y * y > n * n) return cnt;
  return id1[x + n][y + n];
}
int main() {
  scanf("%d%d%d%d%d", &n, &w1, &w2, &w3, &w4);
  tot = (0ll + w1 + w2 + w3 + w4) % mod;
  w1 = 1ll * qp(tot, mod - 2) * w1 % mod;
  w2 = 1ll * qp(tot, mod - 2) * w2 % mod;
  w3 = 1ll * qp(tot, mod - 2) * w3 % mod;
  w4 = 1ll * qp(tot, mod - 2) * w4 % mod;
  for (i = -n; i <= n; i++) {
    for (j = -n; j <= n; j++)
      if (i * i + j * j <= n * n) {
        id1[i + n][j + n] = ++cnt;
      }
  }
  cnt++;
  for (i = -n; i <= n; i++) {
    for (j = -n; j <= n; j++)
      if (i * i + j * j <= n * n) {
        a[id(i, j)][id(i, j)] = a[id(i, j)][cnt + 1] = 1;
        dec(a[id(i, j)][id(i - 1, j)], w1);
        dec(a[id(i, j)][id(i, j - 1)], w2);
        dec(a[id(i, j)][id(i + 1, j)], w3);
        dec(a[id(i, j)][id(i, j + 1)], w4);
      }
  }
  a[cnt][cnt] = 1;
  for ((i) = 1; (i) <= (cnt); ++(i)) {
    for ((j) = (i + 1); (j) <= (cnt); ++(j))
      if (a[j][i]) {
        int t = 1ll * (mod - a[j][i]) * qp(a[i][i], mod - 2) % mod;
        for ((k) = (i); (k) <= (min(cnt, i + n + n + 2)); ++(k)) {
          a[j][k] = (a[j][k] + 1ll * t * a[i][k]) % mod;
        }
        for ((k) = (cnt + 1); (k) <= (cnt + 1); ++(k)) {
          a[j][k] = (a[j][k] + 1ll * t * a[i][k]) % mod;
        }
      }
  }
  for ((i) = (cnt); (i) >= 1; --(i)) {
    for ((j) = (i + 1); (j) <= (cnt); ++(j)) {
      dec(a[i][cnt + 1], 1ll * f[j] * a[i][j] % mod);
    }
    f[i] = 1ll * a[i][cnt + 1] * qp(a[i][i], mod - 2) % mod;
  }
  cout << f[id(0, 0)] << endl;
  return 0;
}