INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a=INT()
    b=INT()
    c=INT()
    d=INT()
    e=INT()
    ct=0
    alls=[a,b,c,d,e]
    for i in alls:
        if i%10!=0:
            ct+=(i//10+1)*10
        else:
            ct+=i
    f=min(a%10,b%10,c%10,d%10,e%10)
    if f!=0:
        ct=ct-(10-f)
    print(ct)
if __name__ == '__main__':
    do()