#include <bits/stdc++.h>
using namespace std;
const int p = 1e9 + 7;
template <typename T>
inline T read() {
  register T sum = 0;
  register char cc = getchar();
  int sym = 1;
  while (cc != '-' && (cc > '9' || cc < '0')) cc = getchar();
  if (cc == '-') sym = -1, cc = getchar();
  sum = sum * 10 + cc - '0';
  cc = getchar();
  while (cc >= '0' && cc <= '9') sum = sum * 10 + cc - '0', cc = getchar();
  return sym * sum;
}
template <typename T>
inline T read(T& a) {
  a = read<T>();
  return a;
}
template <typename T, typename... Others>
inline void read(T& a, Others&... b) {
  a = read(a);
  read(b...);
}
int n, A, cnt, sum, P[10], ans[8010], w[210][210], a[8010][8010];
const int mx[] = {0, -1, 0, 1, 0}, my[] = {0, 0, -1, 0, 1};
int add(int x, int y) { return (x + y) % p; }
int sub(int x, int y) { return (x - y + p) % p; }
int mul(int x, int y) { return 1ll * x * y % p; }
int fpow(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) res = mul(res, x);
    x = mul(x, x);
    y >>= 1;
  }
  return res;
}
int Guass() {
  for (int i = 1; i <= cnt; i++) {
    int o = fpow(a[i][i], p - 2);
    for (int j = i, t = 0; j <= cnt && t <= A; j++, t++)
      a[i][j] = mul(a[i][j], o);
    a[i][0] = mul(a[i][0], o);
    for (int j = i + 1, t1 = 0; j <= cnt && t1 <= A; j++, t1++) {
      o = a[j][i];
      if (!o) continue;
      for (int k = i, t2 = 0; k <= cnt && t2 <= A; k++, t2++)
        a[j][k] = sub(a[j][k], mul(o, a[i][k]));
      a[j][0] = sub(a[j][0], mul(o, a[i][0]));
    }
  }
  for (int i = cnt; i >= 1; i--) {
    ans[i] = mul(a[i][0], fpow(a[i][i], p - 2));
    for (int j = i - 1, t = 0; j >= w[n][n] && t <= A; j--, t++)
      a[j][0] = sub(a[j][0], mul(a[j][i], ans[i]));
  }
  return ans[w[n][n]];
}
int main() {
  read(n);
  A = n << 1;
  for (int i = 1; i <= 4; i++) {
    read(P[i]);
    sum += P[i];
  }
  sum = fpow(sum, p - 2);
  for (int i = 1; i <= 4; i++) P[i] = mul(P[i], sum);
  for (int i = 0; i <= A; i++)
    for (int j = 0; j <= A; j++)
      if ((i - n) * (i - n) + (j - n) * (j - n) <= n * n) w[i][j] = ++cnt;
  for (int i = 0; i <= A; i++)
    for (int j = 0; j <= A; j++)
      if (w[i][j]) {
        for (int k = 1; k <= 4; k++) {
          int x = i + mx[k], y = j + my[k];
          if (w[x][y]) a[w[i][j]][w[x][y]] = p - P[k];
        }
        a[w[i][j]][w[i][j]] = 1;
        a[w[i][j]][0] = 1;
      }
  printf("%d\n", Guass());
  return 0;
}
