Recently Anton found a box with digits in his room. There are k_2 digits 2, k_3 digits 3, k_5 digits 5 and k_6 digits 6.

Anton's favorite integers are 32 and 256. He decided to compose this integers from digits he has. He wants to make the sum of these integers as large as possible. Help him solve this task!

Each digit can be used no more than once, i.e. the composed integers should contain no more than k_2 digits 2, k_3 digits 3 and so on. Of course, unused digits are not counted in the sum.


-----Input-----

The only line of the input contains four integers k_2, k_3, k_5 and k_6 — the number of digits 2, 3, 5 and 6 respectively (0 ≤ k_2, k_3, k_5, k_6 ≤ 5·10^6).


-----Output-----

Print one integer — maximum possible sum of Anton's favorite integers that can be composed using digits from the box.


-----Examples-----
Input
5 1 3 4

Output
800

Input
1 1 1 1

Output
256



-----Note-----

In the first sample, there are five digits 2, one digit 3, three digits 5 and four digits 6. Anton can compose three integers 256 and one integer 32 to achieve the value 256 + 256 + 256 + 32 = 800. Note, that there is one unused integer 2 and one unused integer 6. They are not counted in the answer.

In the second sample, the optimal answer is to create on integer 256, thus the answer is 256.

Difficulty: interview

Starter code:

Solutions:
k2, k3, k5, k6 = list(map(int, input().split()))
c = min(k2, k5, k6)
k2 -= c
ans = 256 * c
ans += 32 * min(k3, k2)
print(ans)


k2, k3, k5, k6 = list(map(int, input().split()))
k256 = min(k2, k5, k6)
k2 -= k256
k5 -= k256
k6 -= k256
k32 = min(k2, k3)
print(k256 * 256 + 32 * k32)


read = lambda: list(map(int, input().split()))
k2, k3, k5, k6 = read()
cnt1 = min(k2, k5, k6)
cnt2 = min(k2 - cnt1, k3)
ans = cnt1 * 256 + cnt2 * 32
print(ans)


k2, k3, k5, k6 = map(int, input().split())
n = min(k2, k5, k6)
m = min(k2 - n, k3)
print(n * 256 + m * 32)

k2, k3, k5, k6 = list(map(int, input().split()))

mn_56 = min(k5, k6)
mn_256 = min(mn_56, k2)

rest_k2 = k2 - mn_256
k32 = min(k3, rest_k2)

print(mn_256 * 256 + k32 * 32)


a, b, c, d = map(int, input().split())
x = min(a, c, d)
ans = x * 256
a-=x
c-=x
d-=x
ans += min(a, b) * 32
print(ans)

k2, k3, k5, k6 = list(map(int, input().split()))

s = min(k2, k5, k6) * 256
k2 -= min(k2, k5, k6)
s += min(k2, k3) * 32

print(s)


a2,a3,a5,a6 = map(int,input().split())
s256 = min(a2,a5,a6)
a2 -= s256
a5 -= s256
a6 -= s256
s32 = min(a2,a3)
print(s256*256+s32*32)

k2, k3, k5, k6 = map(int, input().split(' '))
num256 = min(k2, k5, k6)
ans = 256 * num256
k2 -= num256
num32 = min(k2, k3)
ans += 32 * num32
print(ans)

a = list(map(int, input().split()))
w = min(a[0], a[2], a[3])
am = 256 * w
am += 32 * min(a[0] - w, a[1])
print(am)

a, b, c, d = map(int, input().split())
mini = min(a, c, d)
ans = 0
ans += mini * 256
a -= mini
c -= mini
d -= mini
mini = min(a, b)
ans += mini * 32
print(ans)

k2,k3,k5,k6=map(int,input().split())
s=min(k2,k5,k6)*256
k2=k2-min(k2,k5,k6)
print(s+min(k2,k3)*32)

a, b, c, d = map(int, input().split())
mx = min(a, c, d)
ans = mx * 256 + min(a - mx, b) * 32
print(ans)

a, b, c, d = list(map(int, input().split()))
m = min(a, c, d)
a -= m
c -= m
d -= m
ans = 256 * m
ans += 32 * min(a,b )
print(ans)


a, b, c, d = map(int, input().split())
ans = 0
ans += 256 * min(a, min(c, d))
left = a - ans // 256
ans += 32 * min(b, left)
print(ans)

from math import *
from sys import *
from queue import *

a,b,c,d=(int(z) for z in input().split())
ans=0
ans+=256*min(a,c,d)
a-=min(a,c,d)
ans+=32*min(a,b)
print(ans)

k2, k3, k5, k6 = map(int, input().split())

a = min(k2, k5, k6)
b = min(k3, k2-a)
print(256*a+32*b)

k2, k3, k5, k6 = list(map(int, input().split()))
k = min(k2, min(k5, k6))
ans = k * 256
k2 -= k
ans += 32 * min(k2, k3)
print(ans)


k2, k3, k5, k6 = map(int, input().split())
s = 0
s += 256 * min(k2, k5, k6)
k2 -= min(k2, k5, k6)
s += 32 * min(k2, k3)
print(s)

k2, k3, k5, k6 = [int(x) for x in input().split()]
c1 = min(k2, k5, k6)
ans = c1*256
k2 -= c1
if k2 > 0:
    ans += 32*(min(k2,k3))
print(ans)

__author__ = 'Think'
k2, k3, k5, k6=[int(i) for i in input().split()]
r=min(k5, k6)
if r>k2:
	print(256*k2)
else:
	print(256*r+32*min(k3, k2-r))

#!/usr/bin/env python3


def lmap(f, x):
    return list(map(f, x))


def read_ints():
    return lmap(int, input().strip().split())


def main():
    res = 0
    a2, a3, a5, a6 = read_ints()
    n256 = min(a2, a5, a6)
    res += n256 * 256
    a2 -= n256
    a5 -= n256
    a6 -= n256
    n32 = min(a3, a2)
    res += n32 * 32
    return res


print(main())


l = [int(x) for x in input().split()]
k = min(l[0],l[2],l[3])
a = l[0] - k
j = min(a,l[1])
print(256*k + 32*j)

k2, k3, k5, k6 = list(map(int, input().split()))

n = min(k2, k5, k6)
s = n * 256
k2 -= n
if k2 > 0:
    s += min(k2, k3) * 32
print(s)