func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   void splitstr(const string &s, vector<T> &out) {     istringstream in(s);     out.clear();     copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));   }   static void redirect(int argc, const char **argv) {     ios::sync_with_stdio(false);     cin.tie(NULL);     if (argc > 1) {       static filebuf f;       f.open(argv[1], ios::in);       cin.rdbuf(&f);       if (!cin) {         cerr <<  Failed to open    << argv[1] <<     << endl;         exit(1);       }     }     if (argc > 2) {       static filebuf f;       f.open(argv[2], ios::out | ios::trunc);       cout.rdbuf(&f);       if (!cout) {         cerr <<  Failed to open    << argv[2] <<     << endl;       }     }   }   template <typename T>   static T gcd(T a, T b) {     return b ? gcd(b, a % b) : a;   }   template <typename T>   static T mod(T a, T m) {     a %= m;     if (a < 0) a += m;     return a;   }   template <typename T>   static T inverse(T a, T m) {     a = mod(a, m);     if (a <= 1) return a;     return mod((1 - inverse(m, a) * m) / a, m);   }   template <typename T, typename C, T Modulus>   class MR {    private:     struct tag_plus {};     struct tag_minus {};     struct tag_good {};     T value;     static_assert(std::numeric_limits<C>::max() / Modulus / Modulus > 0,                    compute type is too small );     static_assert(Modulus < std::numeric_limits<T>::max() / 2,                    storage type is too small );     void reduce(tag_plus) {       if (value >= Modulus) value -= Modulus;     }     void reduce(tag_minus) {       if (value < 0) value += Modulus;     }     void reduce(tag_good) {}       public:     static const T modulus = Modulus;     MR() : value(0) {}     MR(C value) : value(value % Modulus) { reduce(tag_minus()); }     template <typename tag_t>     MR(T value, tag_t tag) : value(value) {       reduce(tag);     }     MR &operator=(C value) {       this->value = value % Modulus;       reduce(tag_minus());       return *this;     }     MR operator+(MR b) const { return MR(value + b.value, tag_plus()); }     MR operator-(MR b) const { return MR(value - b.value, tag_minus()); }     MR operator*(MR b) const {       return MR(C(value) * C(b.value) % Modulus, tag_good());     }     MR operator-() const { return MR(-value, tag_minus()); }     MR &operator+=(MR b) {       value += b.value;       reduce(tag_plus());       return *this;     }     MR &operator-=(MR b) {       value -= b.value;       reduce(tag_minus());       return *this;     }     MR &operator*=(MR b) {       value = C(value) * C(b.value) % Modulus;       return *this;     }     bool operator==(MR b) const { return value == b.value; }     bool operator!=(MR b) const { return value != b.value; }     T get() const { return value; }     MR inverse() const {       assert(value);       return MR(::inverse(C(value), C(Modulus)), tag_good());     }     MR operator/(MR b) const { return *this * b.inverse(); }     MR &operator/=(MR b) { return *this *= b.inverse(); }   };   template <typename T, typename C, T Modulus>   static inline std::ostream &operator<<(std::ostream &o, MR<T, C, Modulus> mr) {     return o << mr.get();   }   int main(int argc, const char **argv) {     redirect(argc, argv);     int K, pas, pbs;     cin >> K >> pas >> pbs;     MR<int, long long, 1000000007> pa = MR<int, long long, 1000000007>(pas) /                                         MR<int, long long, 1000000007>(pas + pbs);     MR<int, long long, 1000000007> pb = MR<int, long long, 1000000007>(pbs) /                                         MR<int, long long, 1000000007>(pas + pbs);     vector<vector<MR<int, long long, 1000000007>>> state(         K + 1, vector<MR<int, long long, 1000000007>>(K + 1));     MR<int, long long, 1000000007> scale1 = pa / pb;     state[1][0] = 1;     MR<int, long long, 1000000007> ans;     for (int a = 1; a <= K; a++)       for (int s = 0; s <= K; s++) {         if (state[a][s] == 0) continue;         if (s + a >= K) {           MR<int, long long, 1000000007> t = s + a;           ans += (scale1 + t) * state[a][s];         } else {           state[a + 1][s] += pa * state[a][s];           state[a][s + a] += pb * state[a][s];         }       }     cout << ans <<   n ;     return 0;   }   