#include <bits/stdc++.h>
const int MAXR = 50;
const int MAXS = MAXR * MAXR * 3.15;
const int MOD = 1000000007;
int Pow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = (long long)ret * x % MOD;
    y >>= 1;
    x = (long long)x * x % MOD;
  }
  return ret;
}
void Prod(int &x, int y) { x = (long long)x * y % MOD; }
void Sub(int &x, int y) {
  x -= y;
  if (x < 0) x += MOD;
}
double Dist(std::pair<int, int> x, std::pair<int, int> y) {
  return sqrt((x.first - y.first) * (x.first - y.first) +
              (x.second - y.second) * (x.second - y.second));
}
int R, P1, P2, P3, P4;
int Pos[MAXR * 2 + 5][MAXR * 2 + 5];
std::vector<std::pair<int, int> > P;
int A[MAXS + 5][MAXS + 5], Dp[MAXS + 5];
int main() {
  scanf("%d%d%d%d%d", &R, &P1, &P2, &P3, &P4);
  int totInv = Pow(P1 + P2 + P3 + P4, MOD - 2);
  Prod(P1, totInv), Prod(P2, totInv), Prod(P3, totInv), Prod(P4, totInv);
  for (int i = -R; i <= R; i++)
    for (int j = -R; j <= R; j++)
      if (Dist(std::make_pair(i, j), std::make_pair(0, 0)) <= R) {
        Pos[(i) + MAXR + 1][(j) + MAXR + 1] = P.size() + 1;
        P.push_back(std::make_pair(i, j));
      }
  int N = P.size();
  for (int i = 0; i < N; i++) {
    int x = P[i].first, y = P[i].second;
    A[Pos[(x) + MAXR + 1][(y) + MAXR + 1]][N + 1] = 1;
    A[Pos[(x) + MAXR + 1][(y) + MAXR + 1]]
     [Pos[(x) + MAXR + 1][(y) + MAXR + 1]] = 1;
    A[Pos[(x) + MAXR + 1][(y) + MAXR + 1]]
     [Pos[(x - 1) + MAXR + 1][(y) + MAXR + 1]] = MOD - P1;
    A[Pos[(x) + MAXR + 1][(y) + MAXR + 1]]
     [Pos[(x) + MAXR + 1][(y - 1) + MAXR + 1]] = MOD - P2;
    A[Pos[(x) + MAXR + 1][(y) + MAXR + 1]]
     [Pos[(x + 1) + MAXR + 1][(y) + MAXR + 1]] = MOD - P3;
    A[Pos[(x) + MAXR + 1][(y) + MAXR + 1]]
     [Pos[(x) + MAXR + 1][(y + 1) + MAXR + 1]] = MOD - P4;
  }
  for (int i = 1; i <= N; i++) {
    std::vector<int> Not0;
    int tmp = Pow(A[i][i], MOD - 2);
    for (int j = i; j <= N + 1; j++) {
      Prod(A[i][j], tmp);
      if (A[i][j]) Not0.push_back(j);
    }
    for (int j = i + 1; j <= N; j++) {
      tmp = A[j][i];
      if (tmp)
        for (int k = 0; k < int(Not0.size()); k++)
          Sub(A[j][Not0[k]], (long long)A[i][Not0[k]] * tmp % MOD);
    }
  }
  for (int i = N; i >= 1; i--) {
    Dp[i] = A[i][N + 1];
    for (int j = i + 1; j <= N; j++)
      Sub(Dp[i], (long long)A[i][j] * Dp[j] % MOD);
  }
  printf("%d", Dp[Pos[(0) + MAXR + 1][(0) + MAXR + 1]]);
}
