#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main(){ int g, c, p, pts = 0; string s; cin >> g >> c >> p >> s; for (int i = 0; i < s.size(); i++){ if (s[i] == 'G'){ if (p){ pts += 3; p--; } else if (g){ pts++; g--; } else c--; } else if (s[i] == 'C'){ if (g){ pts += 3; g--; } else if (c){ pts++; c--; } else p--; } else { if (c){ pts += 3; c--; } else if (p){ pts++; p--; } else g--; } } cout << pts << endl; }