#include <bits/stdc++.h>
using namespace std;
long long pow_mod(long long x, int k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = ans * x % 1000000007;
    x = x * x % 1000000007;
    k >>= 1;
  }
  return ans;
}
int n;
struct Vec {
  int num[105];
  Vec() { memset(num, 0, sizeof(num)); }
  Vec operator*(long long k) {
    Vec b;
    for (int i = 1; i <= n + 1; i++) b.num[i] = num[i] * k % 1000000007;
    return b;
  }
  Vec operator-(Vec b) {
    Vec c;
    for (int i = 1; i <= n + 1; i++)
      c.num[i] = (num[i] - b.num[i] + 1000000007) % 1000000007;
    return c;
  }
};
Vec aa[105];
int ans[105];
void gause(int n) {
  for (int i = 1; i <= n; i++) {
    if (!aa[i].num[i]) {
      for (int j = i + 1; j <= n; j++)
        if (aa[j].num[i]) {
          swap(aa[i], aa[j]);
          break;
        }
    }
    long long inv = pow_mod(aa[i].num[i], 1000000007 - 2);
    for (int j = i + 1; j <= n; j++)
      for (int k = n + 1; k >= i; k--)
        aa[j].num[k] = (aa[j].num[k] -
                        (long long)aa[i].num[k] * inv % 1000000007 *
                            aa[j].num[i] % 1000000007 +
                        1000000007) %
                       1000000007;
  }
  for (int i = n; i > 0; i--) {
    ans[i] =
        aa[i].num[n + 1] * pow_mod(aa[i].num[i], 1000000007 - 2) % 1000000007;
    for (int j = i - 1; j > 0; j--)
      aa[j].num[n + 1] =
          (aa[j].num[n + 1] - (long long)ans[i] * aa[j].num[i] % 1000000007 +
           1000000007) %
          1000000007;
  }
}
Vec f[105][105];
bool col[105][105], vis[105][105];
int main() {
  int r;
  long long a, b, c, d;
  scanf("%d%lld%lld%lld%lld", &r, &a, &b, &c, &d);
  long long inv = pow_mod(a + b + c + d, 1000000007 - 2);
  a = a * inv % 1000000007;
  b = b * inv % 1000000007;
  c = c * inv % 1000000007;
  d = d * inv % 1000000007;
  n = 2 * r + 1;
  for (int i = -r; i <= r; i++)
    for (int j = -r; j <= r; j++)
      if (i * i + j * j <= r * r) col[i + r + 1][j + r + 1] = 1;
  int sz = 0, cnt = 0;
  long long v = pow_mod(c, 1000000007 - 2);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++)
      if (col[i][j] && !vis[i][j]) f[i][j].num[++sz] = 1;
    for (int j = 1; j <= n; j++)
      if (col[i][j]) {
        if (col[i + 1][j]) {
          f[i + 1][j] =
              f[i][j] - f[i - 1][j] * a - f[i][j - 1] * b - f[i][j + 1] * d;
          f[i + 1][j].num[n + 1] =
              (f[i + 1][j].num[n + 1] - 1LL + 1000000007) % 1000000007;
          f[i + 1][j] = f[i + 1][j] * v;
          vis[i + 1][j] = 1;
        } else {
          Vec t = f[i][j] - f[i - 1][j] * a - f[i][j - 1] * b - f[i][j + 1] * d;
          t.num[n + 1] = (t.num[n + 1] - 1LL + 1000000007) % 1000000007;
          t.num[n + 1] = (1000000007 - t.num[n + 1]) % 1000000007;
          aa[++cnt] = t;
        }
      }
  }
  gause(cnt);
  int s = f[r + 1][r + 1].num[n + 1];
  for (int i = 1; i <= n; i++)
    s = (s + (long long)f[r + 1][r + 1].num[i] * ans[i]) % 1000000007;
  printf("%d\n", s);
  return 0;
}
