func_code_string: #include <bits/stdc++.h>   using namespace std;   inline void file_handling() {     ios_base::sync_with_stdio(0);     cin.tie(0);   }   void solve() {     string dish;     cin >> dish;     long long b, c, s;     b = s = c = 0;     for (long long i = 0; i < dish.size(); ++i)       if (dish[i] ==  B )         b++;       else if (dish[i] ==  S )         s++;       else         c++;     long long nb, nc, ns;     cin >> nb >> ns >> nc;     long long pb, pc, ps;     cin >> pb >> ps >> pc;     long long rubles;     cin >> rubles;     long long left = 0;     long long right = 1e15;     long long ans = 0;     while (left <= right) {       long long mid = (right + left) / 2;       long long cost = 0;       if (mid * b >= nb) cost += (mid * b - nb) * pb;       if (mid * c >= nc) cost += (mid * c - nc) * pc;       if (mid * s >= ns) cost += (mid * s - ns) * ps;       if (cost <= rubles) {         ans = mid;         left = mid + 1;       } else         right = mid - 1;     }     cout << ans <<   n ;   }   signed main() {     file_handling();     long long testCases = 1;     while (testCases--) solve();     return 0;   }   