func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 112;   const long long mod = 1e9 + 7;   int R;   long long p1, p2, p3, p4, s;   int lim[N];   long long F[N][N];   long long ksm(long long a, long long b = mod - 2) {     long long ret = 1;     for (; b; b >>= 1, a = a * a % mod)       if (b & 1) ret = ret * a % mod;     return ret;   }   struct node {     long long a[N];     node() { memset(a, 0, sizeof a); }   } a[N][N];   node operator*(long long x, node a) {     node c;     for (int i = 0; i <= 2 * R + 1; i++) c.a[i] = a.a[i] * x % mod;     return c;   }   node operator+(node a, node b) {     node c;     for (int i = 0; i <= 2 * R + 1; i++) c.a[i] = (a.a[i] + b.a[i]) % mod;     return c;   }   node operator-(node a, node b) {     node c;     for (int i = 0; i <= 2 * R + 1; i++) c.a[i] = (a.a[i] - b.a[i] + mod) % mod;     return c;   }   void solve() {     int n = 2 * R;     for (int i = 0; i <= n; i++) {       int maxx = i;       for (int j = i + 1; j <= n; j++)         if (abs(F[j][i]) > abs(F[maxx][i])) maxx = j;       swap(F[maxx], F[i]);       for (int j = 0; j <= n; j++) {         if (j != i) {           long long x = F[j][i] * ksm(F[i][i]) % mod;           for (int k = i; k <= n + 1; k++)             F[j][k] = (F[j][k] - F[i][k] * x) % mod;         }       }     }     for (int i = 0; i <= n; i++) F[i][n + 1] = F[i][n + 1] * ksm(F[i][i]) % mod;   }   int main() {     scanf( %d%lld%lld%lld%lld , &R, &p1, &p2, &p3, &p4);     s = p1 + p2 + p3 + p4;     s = ksm(s);     p1 = p1 * s % mod;     p2 = p2 * s % mod;     p3 = p3 * s % mod;     p4 = p4 * s % mod;     int T = R + 3;     p4 = ksm(p4);     for (int i = 0; i <= R; i++)       for (int j = 0; j * j + i * i <= R * R; j++) lim[i] = j;     for (int j = -R; j <= R + 1; j++)       for (int i = -R; i <= R; i++) {         int lt = lim[abs(i)];         if (j == -lt)           a[i + T][-lt + T].a[i + R] = 1;         else if (j > -lt && j <= lt + 1) {           a[i + T][j + T] =               (a[i + T][j - 1 + T] - p1 * a[i - 1 + T][j - 1 + T] -                p2 * a[i + T][j - 2 + T] - p3 * a[i + 1 + T][j - 1 + T]);           (a[i + T][j + T].a[2 * R + 1])--;           (a[i + T][j + T].a[2 * R + 1]) = (a[i + T][j + T].a[2 * R + 1]) % mod;           a[i + T][j + T] = p4 * a[i + T][j + T];         }       }     for (int i = -R; i <= R; i++) {       for (int j = 0; j <= 2 * R + 1; j++)         F[i + R][j] = a[i + T][lim[abs(i)] + 1 + T].a[j];       F[i + R][2 * R + 1] = -F[i + R][2 * R + 1];     }     solve();     long long ans = 0;     for (int i = 0; i <= 2 * R; i++)       ans = (ans + a[T][T].a[i] * F[i][2 * R + 1]) % mod;     ans = (ans + a[T][T].a[2 * R + 1]) % mod;     ans = (ans + mod) % mod;     cout << ans;     return 0;   }   