n = [int(input()) for _ in range(5)]
k = []
g = []

for i in range(len(n)):
    if n[i] % 2 == 0:
        g.append(n[i])
    else:
        k.append(n[i])

km = []
for i in range(len(k)):
    km.append(k[i]%10)

m_number = km.index(min(km)) 
kk = k[m_number]
k.remove(k[m_number])

for j in range(len(k)):
    k[j] = round(k[j],-1)

for l in range(len(g)):
    g[l] = round(g[l],-1)

print(kk+sum(k)+sum(g))