s = list(map(int, input().split())) a = s[:3] b = s[-1] dmg = 0 sumd = sum(s) maxa = max(a) ans = max(sumd, maxa * 3) print(ans)