def amari(num):
  return num % 10
def jikann(a,b,c,d,e):
    an=0
    for i in [a,b,c,d,e]:
        an+=i // 10 * 10
    an=an + 40 + min(a,b,c,d,e,key=amari) % 10
    return an
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print(jikann(a,b,c,d,e))