#include using namespace std; int main(){ int ans = 0; int yuki[3],enemy[3] = {}; string s; cin >> yuki[0] >> yuki[1] >> yuki[2] >> s; for(char c:s){ if(c == 'G') enemy[0]++; else if(c == 'C') enemy[1]++; else enemy[2]++; } int minimum = min(yuki[0],enemy[1]); ans += minimum; yuki[0] -= minimum; enemy[1] -= minimum; minimum = min(yuki[1],enemy[2]); ans += minimum; yuki[1] -= minimum; enemy[2] -= minimum; minimum = min(yuki[2],enemy[0]); ans += minimum; yuki[2] -= minimum; enemy[0] -= minimum; ans *= 3; ans += min(yuki[0],enemy[0]); ans += min(yuki[1],enemy[1]); ans += min(yuki[2],enemy[2]); cout << ans << endl; }