#include <bits/stdc++.h>
using namespace std;
const int maxn = 203;
const int maxm = 251;
const int mod = 1E9 + 7;
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, -1, 0, 1};
int R, A[4], N, X[maxn][maxn], cx;
long long S[7850][maxm], V[7850];
int dis2(int x1, int y1, int x2, int y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
bool valid(int x, int y) {
  if (x < 0 || x > maxn) return false;
  if (y < 0 || y > maxn) return false;
  return X[x][y];
}
long long Pow(long long v, int p) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = (ret * v) % mod;
    p >>= 1;
    v = (v * v) % mod;
  }
  return ret;
}
long long Div(long long a, long long b) { return (a * Pow(b, mod - 2)) % mod; }
long long T[maxm], TV;
void GS() {
  for (int i = 1; i <= cx; ++i) {
    assert(S[i][N] != 0);
    for (int j = N; j < maxm; ++j) T[j] = Div(S[i][j], S[i][N]);
    TV = Div(V[i], S[i][N]);
    for (int j = i + 1; j <= cx && j <= i + N; ++j)
      if (S[j][i - j + N]) {
        for (int k = 0; k < j - i; ++k) assert(S[i][k] == 0);
        for (int k = max(j - i, N + 1); k < maxm; ++k) {
          S[j][i + k - j] -= (T[k] * S[j][i - j + N]) % mod;
          if (S[j][i + k - j] < 0) S[j][i + k - j] += mod;
        }
        V[j] -= (TV * S[j][i - j + N]) % mod;
        if (V[j] < 0) V[j] += mod;
        S[j][i - j + N] = 0;
      }
  }
  for (int i = cx; i; --i) {
    TV = Div(V[i], S[i][N]);
    for (int j = i - 1; j && j > i + N - maxm; --j) {
      V[j] -= (S[j][i - j + N] * TV) % mod;
      if (V[j] < 0) V[j] += mod;
      S[j][i - j + N] = 0;
    }
  }
}
int main() {
  scanf("%d%d%d%d%d", &R, A, A + 1, A + 2, A + 3);
  int tot = A[0] + A[1] + A[2] + A[3];
  for (int i = 0; i < 4; ++i) {
    A[i] = Div(A[i], tot);
  }
  N = R * 2;
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j <= N; ++j) {
      if (dis2(i, j, R, R) <= R * R) X[i][j] = ++cx;
    }
  }
  for (int i = 0; i <= N; ++i) {
    for (int j = 0; j <= N; ++j) {
      if (X[i][j]) {
        V[X[i][j]] = 1;
        S[X[i][j]][N] = 1;
        for (int ix = 0; ix < 4; ++ix) {
          int ni = i + dx[ix], nj = j + dy[ix];
          if (!valid(ni, nj)) continue;
          S[X[i][j]][X[ni][nj] - X[i][j] + N] = mod - A[ix];
        }
      }
    }
  }
  GS();
  cout << Div(V[X[R][R]], S[X[R][R]][N]) << endl;
}
