def main():
    dish = [int(input()) for i in range(5)]
    dish_10 = [ [dish[i]%10, dish[i]] for i in range(5)]
    dish_10.sort()
    ans = 0
    for i in range(1,5):
        ans += ceiling_10(dish_10[i][1])
    ans += dish_10[0][1]
    print(ans)

def ceiling_10(i):
    if (i%10 == 0):
        return i
    else:
        return (i//10+1)*10
main()
