#include <bits/stdc++.h>
using namespace std;
int ksm(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a % 1000000007;
    a = 1ll * a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
inline int add(int a) { return a >= 1000000007 ? a - 1000000007 : a; }
inline int dec(int a) { return a < 0 ? a + 1000000007 : a; }
inline void Add(int &a, int b) {
  ((a += b) >= 1000000007) && (a -= 1000000007);
}
inline void Dec(int &a, int b) { ((a -= b) < 0) && (a += 1000000007); }
int r, a[5], ld[105], inv4, f[105][105][105], v[105][105];
int main() {
  scanf("%d", &r);
  int s = 0;
  for (int i = 1; i <= 4; ++i) scanf("%d", &a[i]), s += a[i];
  s = ksm(s, 1000000007 - 2);
  for (int i = 1; i <= 4; ++i) a[i] = 1ll * a[i] * s % 1000000007;
  inv4 = ksm(a[4], 1000000007 - 2);
  for (int i = -r; i <= r; ++i) {
    for (int j = 0; j <= r; ++j) {
      if (i * i + j * j > r * r) {
        ld[i + r + 1] = j - 1;
        goto ending;
      }
    }
    ld[i + r + 1] = r;
  ending:;
  }
  int up = r + r + 1;
  for (int j = -r; j <= r + 1; ++j) {
    for (int i = 1; i <= up; ++i) {
      if (j < -ld[i] || j > ld[i] + 1) continue;
      if (j == -ld[i]) {
        f[i][j + r][i] = 1;
        continue;
      }
      for (int k = 0; k <= up; ++k) {
        f[i][j + r][k] =
            dec((f[i][j + r - 1][k] - 1ll * a[1] * f[i - 1][j + r - 1][k] -
                 1ll * a[2] * f[i][j + r - 2][k] -
                 1ll * a[3] * f[i + 1][j + r - 1][k]) %
                1000000007 * inv4 % 1000000007);
      }
      Dec(f[i][j + r][0], inv4);
    }
  }
  for (int i = 1; i <= up; ++i) {
    for (int j = 1; j <= up; ++j) {
      v[i][j] = f[i][ld[i] + 1 + r][j];
    }
    v[i][up + 1] = add(1000000007 - f[i][ld[i] + 1 + r][0]);
  }
  for (int i = 1; i <= up; ++i) {
    if (!v[i][i])
      for (int j = i + 1; j <= up; ++j) {
        if (v[j][i]) {
          for (int k = i; k <= up + 1; ++k) swap(v[i][k], v[j][k]);
        }
      }
    int inv = ksm(v[i][i], 1000000007 - 2);
    for (int j = i; j <= up + 1; ++j)
      v[i][j] = 1ll * inv * v[i][j] % 1000000007;
    for (int j = 1; j <= up; ++j) {
      if (i == j) continue;
      inv = v[j][i];
      for (int k = i; k <= up + 1; ++k) {
        Dec(v[j][k], 1ll * v[i][k] * inv % 1000000007);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= up; ++i) {
    Add(ans, 1ll * f[r + 1][r][i] * v[i][up + 1] % 1000000007);
  }
  Add(ans, f[r + 1][r][0]);
  printf("%d\n", ans);
  return 0;
}
