#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 205;
int r, p1, p2, p3, p4, ip3, n, ans, sum, isum, p;
int lim[N], f[N][N][N], g[N][N], h[N];
inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
inline int mul(int a, int b) { return 1ll * a * b % mod; }
inline int qpow(int a, int b) {
  int c = 1;
  for (; b; b >>= 1, a = mul(a, a))
    if (b & 1) c = mul(a, c);
  return c;
}
inline void gauss() {
  for (int i = 1; i <= n; i++) {
    int r = 0;
    for (int j = i; j <= n; j++)
      if (f[j][i] != 0) {
        r = j;
        break;
      }
    if (i != r) swap(g[i], g[r]);
    int inv = qpow(g[i][i], mod - 2);
    for (int j = i; j <= n + 1; j++) g[i][j] = mul(g[i][j], inv);
    for (int j = i + 1; j <= n; j++) {
      for (int k = i + 1; k <= n + 1; k++)
        g[j][k] = add(g[j][k], mod - mul(g[j][i], g[i][k]));
      g[j][i] = 0;
    }
  }
  for (int i = n; i >= 1; i--) {
    h[i] = g[i][n + 1];
    for (int j = i + 1; j <= n; j++) h[i] = add(h[i], mod - mul(h[j], g[i][j]));
  }
}
int main() {
  cin >> r >> p1 >> p2 >> p3 >> p4;
  p = r + 5;
  sum = p1 + p2 + p3 + p4;
  sum %= mod;
  isum = qpow(sum, mod - 2);
  p1 = mul(p1, isum), p2 = mul(p2, isum), p3 = mul(p3, isum),
  p4 = mul(p4, isum);
  ip3 = qpow(p3, mod - 2), n = r + r + 1;
  for (int i = -r; i <= r; i++)
    lim[i + p] = int(sqrt(r * r - i * i) + 1),
            f[p - lim[i + p] + 1][i + p][i + r] = 1;
  for (int i = -r + 1; i <= r + 1; i++) {
    for (int j = -r; j <= r; j++) {
      if (i > -lim[j + p] + 1 && i <= lim[j + p]) {
        for (int k = 0; k <= n; k++) {
          f[i + p][j + p][k] =
              mul(ip3, add(f[i - 1 + p][j + p][k],
                           mod - (1ll * mul(p1, f[i - 2 + p][j + p][k]) +
                                  1ll * mul(p2, f[i - 1 + p][j - 1 + p][k]) +
                                  1ll * mul(p4, f[i - 1 + p][j + 1 + p][k])) %
                                     mod));
        }
        f[i + p][j + p][n] = add(f[i + p][j + p][n], mod - ip3);
      }
    }
  }
  for (int i = -r; i <= r; i++) {
    for (int j = 0; j < n; j++) {
      g[i + r + 1][j + 1] = f[p + lim[i + p]][i + p][j];
    }
    g[i + r + 1][n + 1] = mod - f[p + lim[i + p]][i + p][n];
    if (g[i + r + 1][n + 1] == mod) g[i + r + 1][n + 1] = 0;
  }
  gauss();
  for (int i = 1; i <= n; i++) ans = add(ans, mul(h[i], f[p][p][i - 1]));
  ans = add(ans, f[p][p][n]);
  cout << ans;
  return 0;
}
