func_code_string: #include <bits/stdc++.h>   using namespace std;   struct trio {     int64_t first, second, trd;     friend ostream &operator<<(ostream &o, trio &a) {       o <<  (  << a.first <<  ,  << a.second <<  ,  << a.trd <<  ) ;       return o;     }   };   template <typename T>   inline T max() {     return numeric_limits<T>::max();   }   template <typename T>   inline T gcd(T a, T b) {     return b == 0 ? a : gcd(b, a % b);   }   template <typename T>   inline void get(T &&v) {     cin >> v;   }   template <typename T, typename... Args>   inline void get(T &&v, Args &&...args) {     cin >> v;     get(args...);   }   template <typename T>   inline void put(T &&v) {     cout << v <<   n ;   }   template <typename T, typename... Args>   inline void put(T &&v, Args &&...args) {     cout << v <<    ;     put(args...);   }   template <typename T>   inline void putc(T &&a, const string s =    ) {     {       for (auto &v : a) cout << v << s;     }     cout <<   n ;   }   ostream &operator<<(ostream &out, pair<int32_t, int32_t> &a) {     out <<  (  << a.first <<  ,  << a.second <<  ) ;     return out;   }   ostream &operator<<(ostream &out, pair<int64_t, int64_t> &a) {     out <<  (  << a.first <<  ,  << a.second <<  ) ;     return out;   }   vector<int32_t> primes;   inline void calc_primes(int32_t lmt) {     vector<char> s(lmt);     primes.push_back(2);     for (int32_t i = 3; i < lmt; i += 2) {       if (s[i]) continue;       primes.push_back(i);       for (int32_t j = i + (i << 1); j < lmt; j += (i << 1)) s[j] = 1;     }   }   inline vector<pair<int32_t, int32_t> > factorize(int32_t n) {     vector<pair<int32_t, int32_t> > a;     int32_t cnt = __builtin_ctzl(n);     a.push_back({2, cnt});     n >>= cnt;     for (auto &d : primes) {       cnt = 0;       while (n % d == 0) n /= d, cnt++;       a.push_back({d, cnt});       if (n == 1) break;     }     if (n != 1) a.push_back({n, 1});     return a;   }   int64_t mod = 1e9 + 9;   inline int64_t mmul(int64_t a, int64_t n) {     if (a < 0) a += mod;     if (n < 0) n += mod;     int64_t r = 0;     while (n) {       if (n & 1) r = (r + a) % mod;       a = (a + a) % mod;       n >>= 1;     }     return r;   }   inline int64_t mpow(int64_t a, int64_t n) {     if (a < 0) a += mod;     if (n < 0) n += mod;     int64_t r = 1;     while (n) {       if (n & 1) r = mmul(r, a);       a = mmul(a, a);       n >>= 1;     }     return r;   }   int main() {     {       ios_base::sync_with_stdio(false);       cin.tie(nullptr);       cout << setprecision(20);     };     int64_t n, a, b, k;     get(n, a, b, k);     int64_t inv_a = mpow(a, mod - 2);     int64_t aa = mpow(a, n);     int64_t bb = 1;     int64_t z = 0;     for (int64_t i = 0; i < k; ++i) {       char c;       cin >> c;       int64_t sgn = (c ==  +  ? 1 : -1);       z = (z + sgn * mmul(aa, bb)) % mod;       aa = mmul(aa, inv_a);       bb = mmul(bb, b);     }     int64_t q = mmul(bb, mpow(inv_a, k));     int64_t s = 0, t = (n + 1) / k;     if (q == 1)       s = t;     else       s = mmul((mod + 1 - mpow(q, t)), mpow(mod + 1 - q, mod - 2));     z = mmul(z, s);     if (z < 0) z += mod;     put(z);     return 0;   }   