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>
class mint {
 public:
  unsigned int v;
  static unsigned int _minu(unsigned int k) {
    return (unsigned long long int)((unsigned int)1e9 + 7) * 3 +
           ((int)k >> 31 & ((unsigned int)1e9 + 7) * 2) - k;
  }
  static unsigned int _invu(unsigned int k) {
    long long int a = k, b = ((unsigned int)1e9 + 7), ca = 1, cb = 0;
    while (b) {
      long long int c = a / b, t = a % b, ct = ca - cb * c;
      a = b, ca = cb;
      b = t, cb = ct;
    }
    return (ca + ((long long int)((unsigned int)1e9 + 7) << 32)) %
           ((unsigned int)1e9 + 7);
  }
  static unsigned int _addu(unsigned int a, unsigned int b) {
    unsigned long long int k = (unsigned long long int)a + b;
    if (k > (unsigned long long int)((unsigned int)1e9 + 7) * 4)
      k -= (unsigned long long int)((unsigned int)1e9 + 7) * 4;
    return (unsigned int)k;
  }
  static unsigned int _subu(unsigned int a, unsigned int b) {
    return _addu(a, _minu(b));
  }
  static unsigned int _mulu(unsigned int a, unsigned int b) {
    unsigned long long int k = (unsigned long long int)a * b;
    k = (k & ((1ull << 41) - 1)) +
        (k >> 41) * ((1ull << 41) % ((unsigned int)1e9 + 7));
    k = (k & ((1ull << 39) - 1)) +
        (k >> 39) * ((1ull << 39) % ((unsigned int)1e9 + 7));
    k = (k & ((1ull << 34) - 1)) +
        (k >> 34) * ((1ull << 34) % ((unsigned int)1e9 + 7));
    k = (k & ((1ull << 30) - 1)) +
        (k >> 30) * ((1ull << 30) % ((unsigned int)1e9 + 7));
    return (unsigned int)k;
  }
  static unsigned int _divu(unsigned int a, unsigned int b) {
    return _mulu(a, _invu(b));
  }
  static unsigned int _check(unsigned int k) {
    k -= ((int)k << 0 >> 31) & (((unsigned int)1e9 + 7) * 2);
    k -= ((int)k << 1 >> 31) & (((unsigned int)1e9 + 7) * 1);
    if (k >= ((unsigned int)1e9 + 7)) k -= ((unsigned int)1e9 + 7);
    return k;
  }
  mint() : v() {}
  mint(unsigned int _v) : v(_v) {}
  mint &operator+=(const mint &x) { return v = _addu(v, x.v), *this; }
  mint &operator-=(const mint &x) { return v = _subu(v, x.v), *this; }
  mint &operator*=(const mint &x) { return v = _mulu(v, x.v), *this; }
  mint &operator/=(const mint &x) { return v = _divu(v, x.v), *this; }
  mint operator+(const mint &x) const { return mint(_addu(v, x.v)); }
  mint operator-(const mint &x) const { return mint(_subu(v, x.v)); }
  mint operator*(const mint &x) const { return mint(_mulu(v, x.v)); }
  mint operator/(const mint &x) const { return mint(_divu(v, x.v)); }
  mint operator-() const { return mint(_minu(v)); }
  mint operator~() const { return mint(_invu(v)); }
  operator bool() const { return _check(v); }
  bool operator!() const { return !_check(v); }
  bool operator==(const mint &x) const { return _check(v) == _check(x.v); }
  bool operator!=(const mint &x) const { return _check(v) != _check(x.v); }
  operator unsigned int() const { return _check(v); }
};
mint p1, p2, p3, p4;
std::list<std::pair<int, mint>> po[128], ans;
int r, r2;
bool isin(int n, int r2) {
  int x = (n & 0x7f) - 64, y = (n >> 7) - 64;
  return x * x + y * y <= r2;
}
mint find(std::list<std::pair<int, mint>> &p, int x) {
  for (auto i : p)
    if (x <= i.first) return x == i.first ? i.second : (mint)0;
  return 0;
}
void add(std::list<std::pair<int, mint>> &p, std::list<std::pair<int, mint>> &q,
         mint k) {
  for (auto iq = q.begin(), ip = p.begin(); iq != q.end(); ++iq) {
    while (ip->first < iq->first) ++ip;
    if (ip->first > iq->first)
      ip = p.insert(ip, std::pair<int, mint>(iq->first, 0));
    ip->second += iq->second * k;
    if (ip->first != 16384 && !ip->second) ip = p.erase(ip);
  }
}
void build(std::list<std::pair<int, mint>> &p, int x) {
  if (isin(x - 128, r2)) p.push_back(std::pair<int, mint>(x - 128, p2));
  if (isin(x - 1, r2)) p.push_back(std::pair<int, mint>(x - 1, p1));
  p.push_back(std::pair<int, mint>(x, 1));
  if (isin(x + 1, r2)) p.push_back(std::pair<int, mint>(x + 1, p3));
  if (isin(x + 128, r2)) p.push_back(std::pair<int, mint>(x + 128, p4));
  p.push_back(std::pair<int, mint>(16384, 1));
}
int main() {
  mint k;
  scanf("%d%u%u%u%u", &r, &p1.v, &p2.v, &p3.v, &p4.v), r2 = r * r;
  k = -~(p1 + p2 + p3 + p4), p1 *= k, p2 *= k, p3 *= k, p4 *= k;
  build(ans, (64 << 7 | 64));
  for (int i = 0; i < 16384; ++i) {
    if (!isin(i, r2)) continue;
    std::list<std::pair<int, mint>> p;
    build(p, i);
    while (p.front().first < i) {
      0;
      add(p, po[p.front().first % 128], -p.front().second);
    }
    0;
    k = ~p.front().second;
    for (auto &i : p) i.second *= k;
    0;
    po[i % 128] = p;
    if (i != (64 << 7 | 64) && (k = find(ans, i))) add(ans, p, -k);
  }
  0;
  printf("%u\n", (unsigned int)(ans.back().second / ans.front().second));
  return 0;
}