#include int main () { int a[3] = {}; int b = 0; int res = 0; int ans = 0; res = scanf("%d", a); res = scanf("%d", a+1); res = scanf("%d", a+2); res = scanf("%d", &b); ans = a[0]+a[1]+a[2]+b; if (a[2]*3 > ans) { ans = a[2]*3; } printf("%d\n", ans); return 0; }