a[3],b[4],s,t;main(i){for(scanf("%d%d%d",a,a+1,a+2);i=~getchar();b[i+10>>2&3]++);for(;i<3;s+=t*3,a[i]-=t,b[++i%3]-=t)t=a[i]<(t=b[(1+i)%3])?a[i]:t;for(;i--;s+=a[i]