#include using namespace std; int main() { int A[3], B[3] = {}; string S; for (int i = 0; i < 3; i++) { cin >> A[i]; } cin >> S; for (auto& c : S) { if (c == 'G') B[0]++; else if (c == 'C') B[1]++; else B[2]++; } int ans = 0; for (int i = 0; i < 3; i++) { int j = (i + 1) % 3; int t = min(A[i], B[j]); A[i] -= t; B[j] -= t; ans += t * 3; } for (int i = 0; i < 3; i++) { ans += min(A[i], B[i]); } cout << ans << endl; }