func_code_string: #include <bits/stdc++.h>   using namespace std;   int dx[] = {1, -1, 0, 0};   int dy[] = {0, 0, 1, -1};   double PI = 3.1415926535897932384626433832795;   const long long oo = (long long)1e9 + 1;   const double eps = 1e-9;   const long long mod = 1000000007;   string s;   long long nb, ns, nc, pb, ps, pc, R;   int main() {     cin >> s;     cin >> nb >> ns >> nc;     cin >> pb >> ps >> pc;     cin >> R;     int cb = 0, cs = 0, cc = 0;     for (int i = 0; s[i]; i++)       if (s[i] ==  B )         cb++;       else if (s[i] ==  S )         cs++;       else         cc++;     long long l = 0, r = 1e15, ret = 0;     while (l <= r) {       long long mid = (l + r) >> 1;       if (max(cb * mid - nb, 0ll) * pb + max(cs * mid - ns, 0ll) * ps +               max(cc * mid - nc, 0ll) * pc <=           R)         ret = mid, l = mid + 1;       else         r = mid - 1;     }     cout << ret << endl;     return 0;   }   