Problem: A chip was placed on a field with coordinate system onto point (0, 0).

Every second the chip moves randomly. If the chip is currently at a point (x, y), after a second it moves to the point (x - 1, y) with probability p1, to the point (x, y - 1) with probability p2, to the point (x + 1, y) with probability p3 and to the point (x, y + 1) with probability p4. It's guaranteed that p1 + p2 + p3 + p4 = 1. The moves are independent.

Find out the expected time after which chip will move away from origin at a distance greater than R (i.e. <image> will be satisfied).

Input

First line contains five integers R, a1, a2, a3 and a4 (0 ≤ R ≤ 50, 1 ≤ a1, a2, a3, a4 ≤ 1000).

Probabilities pi can be calculated using formula <image>.

Output

It can be shown that answer for this problem is always a rational number of form <image>, where <image>.

Print P·Q - 1 modulo 109 + 7. 

Examples

Input

0 1 1 1 1


Output

1

Input

1 1 1 1 1


Output

666666674

Input

1 1 2 1 2


Output

538461545

Note

In the first example initially the chip is located at a distance 0 from origin. In one second chip will move to distance 1 is some direction, so distance to origin will become 1.

Answers to the second and the third tests: <image> and <image>.

Solution (in CPP):

Solution:
#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;
}