#include <bits/stdc++.h>
using namespace std;
struct mint_t {
  int v_;
  int inv_;
  mint_t(int v = 0) : v_(v % 1000000007), inv_(0) {}
  mint_t(const mint_t& other) : v_(other.v_), inv_(0) {}
  mint_t operator=(const mint_t& other) {
    v_ = other.v_;
    return *this;
  }
  bool operator==(const mint_t& other) const { return v_ == other.v_; }
  bool operator!=(const mint_t& other) const { return v_ != other.v_; }
  mint_t operator+(const mint_t& other) const {
    return mint_t((v_ + other.v_) % 1000000007);
  }
  mint_t operator-(const mint_t& other) const {
    return mint_t((v_ - other.v_ + 1000000007) % 1000000007);
  }
  mint_t operator*(const mint_t& other) const {
    return mint_t((1ll * v_ * other.v_) % 1000000007);
  }
  mint_t operator^(int k) const {
    if (k == 0) return mint_t(1);
    auto ans = (*this) ^ (k / 2);
    ans = ans * ans;
    if (k % 2) ans = ans * (*this);
    return ans;
  }
  mint_t inv() {
    if (inv_ != 0) return mint_t(inv_);
    return mint_t(inv_ = ((*this) ^ (1000000007 - 2)).v_);
  }
  mint_t operator/(mint_t& other) { return (*this) * other.inv(); }
  mint_t operator-() const { return mint_t(1000000007) - (*this); }
  mint_t operator+=(const mint_t& other) { return (*this) = (*this) + other; }
  mint_t operator-=(const mint_t& other) { return (*this) = (*this) - other; }
  mint_t operator*=(const mint_t& other) { return (*this) = (*this) * other; }
  mint_t operator/=(mint_t& other) { return (*this) = (*this) / other; }
};
ostream& operator<<(ostream& out, const mint_t& b) { return out << b.v_; }
int RADIUS;
mint_t A[(2 * (51 + 1) + 1) * (2 * (51 + 1) + 1)][3 * (2 * (51 + 1) + 1)];
mint_t B[(2 * (51 + 1) + 1) * (2 * (51 + 1) + 1)];
inline void make_replacement(int x, int y, int idx, int x2, int y2, int idx2) {
  auto z =
      A[idx]
       [((x2) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * (((y2) - (y) + 1))] /
      A[idx2]
       [((x2) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * (((y2) - (y2) + 1))];
  for (int y3 = (y2 - 1); y3 <= (y2); ++y3) {
    if (y3 < -(RADIUS + 1)) continue;
    for (int x3 = (-(RADIUS + 1)); x3 <= ((RADIUS + 1)); ++x3) {
      A[idx]
       [((x3) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * (((y3) - (y) + 1))] -=
          z * A[idx2][((x3) + (RADIUS + 1)) +
                      (2 * (RADIUS + 1) + 1) * (((y3) - (y2) + 1))];
    }
  }
  B[idx] -= z * B[idx2];
}
void solve() {
  int x, y, idx, x2, y2, idx2;
  for (y = ((RADIUS + 1)); y >= (-(RADIUS + 1)); --y) {
    for (x = ((RADIUS + 1)); x >= (-(RADIUS + 1)); --x) {
      idx =
          ((x) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * ((y) + (RADIUS + 1));
      {
        x2 = x;
        y2 = y + 1;
        idx2 = ((x2) + (RADIUS + 1)) +
               (2 * (RADIUS + 1) + 1) * ((y2) + (RADIUS + 1));
        if (y2 < -(RADIUS + 1) || y2 > (RADIUS + 1)) continue;
        if (((A[idx][((x2) + (RADIUS + 1)) +
                     (2 * (RADIUS + 1) + 1) * (((y2) - (y) + 1))]) == 0))
          continue;
        make_replacement(x, y, idx, x2, y2, idx2);
      }
    }
    for (x = ((RADIUS + 1)); x >= (-(RADIUS + 1)); --x) {
      idx =
          ((x) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * ((y) + (RADIUS + 1));
      for (x2 = ((RADIUS + 1)); x2 >= (x + 1); --x2) {
        y2 = y;
        idx2 = ((x2) + (RADIUS + 1)) +
               (2 * (RADIUS + 1) + 1) * ((y2) + (RADIUS + 1));
        if (((A[idx][((x2) + (RADIUS + 1)) +
                     (2 * (RADIUS + 1) + 1) * (((y2) - (y) + 1))]) == 0))
          continue;
        make_replacement(x, y, idx, x2, y2, idx2);
      }
    }
    for (x = (-(RADIUS + 1)); x <= ((RADIUS + 1)); ++x) {
      idx =
          ((x) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * ((y) + (RADIUS + 1));
      for (x2 = (-(RADIUS + 1)); x2 <= (x - 1); ++x2) {
        y2 = y;
        idx2 = ((x2) + (RADIUS + 1)) +
               (2 * (RADIUS + 1) + 1) * ((y2) + (RADIUS + 1));
        if (((A[idx][((x2) + (RADIUS + 1)) +
                     (2 * (RADIUS + 1) + 1) * (((y2) - (y) + 1))]) == 0))
          continue;
        make_replacement(x, y, idx, x2, y2, idx2);
      }
    }
  }
  for (y = (-(RADIUS + 1)); y <= ((RADIUS + 1)); ++y) {
    for (x = (-(RADIUS + 1)); x <= ((RADIUS + 1)); ++x) {
      idx =
          ((x) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * ((y) + (RADIUS + 1));
      y2 = y - 1;
      if (y2 < -(RADIUS + 1) || y2 > (RADIUS + 1)) continue;
      for (int x2 = (-(RADIUS + 1)); x2 <= ((RADIUS + 1)); ++x2) {
        idx2 = ((x2) + (RADIUS + 1)) +
               (2 * (RADIUS + 1) + 1) * ((y2) + (RADIUS + 1));
        B[idx] -= B[idx2] * A[idx][((x2) + (RADIUS + 1)) +
                                   (2 * (RADIUS + 1) + 1) * (((y2) - (y) + 1))];
        A[idx][((x2) + (RADIUS + 1)) +
               (2 * (RADIUS + 1) + 1) * (((y2) - (y) + 1))] = 0;
      }
      B[idx] /= A[idx][((x) + (RADIUS + 1)) +
                       (2 * (RADIUS + 1) + 1) * (((y) - (y) + 1))];
      A[idx]
       [((x) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * (((y) - (y) + 1))] = 1;
    }
  }
}
int main() {
  int a_, b_, c_, d_;
  scanf("%d%d%d%d%d", &RADIUS, &a_, &b_, &c_, &d_);
  mint_t a(a_), b(b_), c(c_), d(d_);
  mint_t sum{a + b + c + d};
  a /= sum;
  b /= sum;
  c /= sum;
  d /= sum;
  assert(a + b + c + d == mint_t(1));
  for (int y = (-(RADIUS + 1)); y <= ((RADIUS + 1)); ++y)
    for (int x = (-(RADIUS + 1)); x <= ((RADIUS + 1)); ++x) {
      int idx =
          ((x) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * ((y) + (RADIUS + 1));
      if (x * x + y * y > RADIUS * RADIUS) {
        B[idx] = 0;
        A[idx][((x) + (RADIUS + 1)) +
               (2 * (RADIUS + 1) + 1) * (((y) - (y) + 1))] = 1;
      } else {
        int i1 = ((x - 1) + (RADIUS + 1)) +
                 (2 * (RADIUS + 1) + 1) * (((y) - (y) + 1));
        int i2 = ((x) + (RADIUS + 1)) +
                 (2 * (RADIUS + 1) + 1) * (((y - 1) - (y) + 1));
        int i3 = ((x + 1) + (RADIUS + 1)) +
                 (2 * (RADIUS + 1) + 1) * (((y) - (y) + 1));
        int i4 = ((x) + (RADIUS + 1)) +
                 (2 * (RADIUS + 1) + 1) * (((y + 1) - (y) + 1));
        A[idx][((x) + (RADIUS + 1)) +
               (2 * (RADIUS + 1) + 1) * (((y) - (y) + 1))] = 1;
        A[idx][i1] = -a;
        A[idx][i2] = -b;
        A[idx][i3] = -c;
        A[idx][i4] = -d;
        B[idx] = 1;
      }
    }
  solve();
  int origin =
      ((0) + (RADIUS + 1)) + (2 * (RADIUS + 1) + 1) * ((0) + (RADIUS + 1));
  cout << B[origin] << endl;
}
