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;
clock_t __stt;
inline void TStart() { __stt = clock(); }
inline void TReport() {
  cerr << fixed << setprecision(3) << "\nCurrent Case Taken Time : "
       << (double)(clock() - __stt) / CLOCKS_PER_SEC << "sec\n";
}
template <typename T>
T MIN(T a, T b) {
  return a < b ? a : b;
}
template <typename T>
T MAX(T a, T b) {
  return a > b ? a : b;
}
template <typename T>
T ABS(T a) {
  return a > 0 ? a : (-a);
}
template <typename T>
void UMIN(T &a, T b) {
  if (b < a) a = b;
}
template <typename T>
void UMAX(T &a, T b) {
  if (b > a) a = b;
}
const int MX = 7845, dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1}, CX = 105;
int R, p[4], q[4];
int powM(int V, int T) {
  int R = 1;
  while (T) {
    if (T & 1) R = (long long)R * (long long)V % 1000000007LL;
    T >>= 1;
    V = (long long)V * (long long)V % 1000000007LL;
  }
  return R;
}
int px[MX], py[MX], id[205][205], cnt;
int expr[MX][CX], arr[CX][CX], x[CX], ect;
bool got[MX], used[MX];
int main() {
  int i, j, k, s = 0;
  scanf("%d", &R);
  for (i = 0; i < 4; ++i) {
    scanf("%d", p + i);
    s += p[i];
  }
  for (i = 0; i < 4; ++i) {
    q[i] =
        (long long)p[i] * (long long)powM(s, 1000000007LL - 2ll) % 1000000007LL;
  }
  memset(id, -1, sizeof(id));
  for (i = -100; i <= 100; ++i) {
    for (j = -100; j <= 100; ++j) {
      if (i * i + j * j <= R * R) {
        px[cnt] = i;
        py[cnt] = j;
        id[i + 100][j + 100] = cnt++;
      }
    }
  }
  ect = 1;
  for (i = -100; i <= 100; ++i) {
    for (j = -100; j <= 100; ++j) {
      if (i * i + j * j <= R * R) break;
    }
    if (j <= 100) {
      expr[id[i + 100][j + 100]][ect++] = 1;
      got[id[i + 100][j + 100]] = 1;
    }
  }
  while (1) {
    bool upd = 0;
    for (i = 0; i < cnt; ++i) {
      if (!got[i]) continue;
      int x = px[i], y = py[i], nct = 0, e;
      for (j = 0; j < 4; ++j) {
        int nx = x + dx[j], ny = y + dy[j];
        int d = id[nx + 100][ny + 100];
        if (d != -1 && !got[d]) e = d, ++nct;
      }
      if (nct == 1) {
        upd = 1;
        memcpy(expr[e], expr[i], sizeof(expr[i]));
        expr[e][0] += 1000000007LL - 1ll;
        if (expr[e][0] >= 1000000007LL) expr[e][0] -= 1000000007LL;
        int inv = 1926;
        for (j = 0; j < 4; ++j) {
          int nx = x + dx[j], ny = y + dy[j];
          int d = id[nx + 100][ny + 100];
          if (d != -1 && got[d]) {
            for (k = 0; k < ect; ++k) {
              expr[e][k] += 1000000007LL - (long long)expr[d][k] *
                                               (long long)q[j] % 1000000007LL;
              if (expr[e][k] >= 1000000007LL) expr[e][k] -= 1000000007LL;
            }
          } else if (d == e)
            inv = powM(q[j], 1000000007LL - 2ll);
        }
        for (j = 0; j < ect; ++j) {
          expr[e][j] = (long long)expr[e][j] * (long long)inv % 1000000007LL;
        }
        used[i] = got[e] = 1;
      }
    }
    if (!upd) break;
  }
  int ptr = 0;
  for (i = 0; i < cnt; ++i) {
    if (used[i]) continue;
    int x = px[i], y = py[i];
    for (j = 1; j < ect; ++j) arr[ptr][j - 1] = expr[i][j];
    arr[ptr][ect - 1] =
        (1000000007LL + 1ll - (long long)expr[i][0]) % 1000000007LL;
    for (j = 0; j < 4; ++j) {
      int nx = x + dx[j], ny = y + dy[j], d = id[nx + 100][ny + 100];
      if (d != -1) {
        for (k = 1; k < ect; ++k) {
          arr[ptr][k - 1] += 1000000007LL - (long long)expr[d][k] *
                                                (long long)q[j] % 1000000007LL;
          if (arr[ptr][k - 1] >= 1000000007LL) arr[ptr][k - 1] -= 1000000007LL;
        }
        arr[ptr][ect - 1] +=
            (long long)expr[d][0] * (long long)q[j] % 1000000007LL;
        if (arr[ptr][ect - 1] >= 1000000007LL)
          arr[ptr][ect - 1] -= 1000000007LL;
      }
    }
    ++ptr;
  }
  for (i = 0; i < ptr; ++i) {
    for (j = i; j < ptr; ++j) {
      if (arr[j][i]) break;
    }
    if (j == ptr) continue;
    if (j > i) {
      for (k = 0; k <= ptr; ++k) {
        swap(arr[i][k], arr[j][k]);
      }
    }
    for (j = i + 1; j < ptr; ++j) {
      if (!arr[j][i]) continue;
      int coe =
          (1000000007LL - (long long)arr[j][i] *
                              (long long)powM(arr[i][i], 1000000007LL - 2ll) %
                              1000000007LL) %
          1000000007LL;
      for (k = i; k <= ptr; ++k) {
        arr[j][k] += (long long)coe * (long long)arr[i][k] % 1000000007LL;
        if (arr[j][k] >= 1000000007LL) arr[j][k] -= 1000000007LL;
      }
    }
  }
  for (i = ptr - 1; i >= 0; --i) {
    for (k = ptr - 1; k > i; --k) {
      arr[i][ptr] +=
          1000000007LL - (long long)arr[i][k] * (long long)x[k] % 1000000007LL;
      if (arr[i][ptr] >= 1000000007LL) arr[i][ptr] -= 1000000007LL;
    }
    x[i] = (long long)arr[i][ptr] *
           (long long)powM(arr[i][i], 1000000007LL - 2ll) % 1000000007LL;
  }
  int d = id[100][100], res = expr[d][0];
  for (i = 1; i < ect; ++i) {
    res += (long long)expr[d][i] * (long long)x[i - 1] % 1000000007LL;
    res %= 1000000007LL;
  }
  printf("%d\n", res);
  return 0;
}