import sys

import math

import numpy as np



def main():

    dish = np.array(sys.stdin.read().split())



    minute = [int(dish[i][-1]) for i in range(5)]

    m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10



    res = (np.ceil(dish.astype(np.int64) / 10) * 10).sum() - 10 + m



    print((int(res)))



if __name__ == "__main__":

    main()

import sys



*T, = list(map(int ,sys.stdin.read().split()))



def main():

    res = 0

    e = 10

    for t in T:

        res += 10 * ((t + 10 - 1) // 10)

        e = min(e, (t - 1) % 10 + 1)



    res -= (10 - e)

    return res



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys
import math
import numpy as np


def main():
    dish = np.array(sys.stdin.read().split())
    minute = [int(dish[i][-1]) for i in range(5)]
    m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10
    res = (np.ceil(dish.astype(np.int64) / 10) * 10).sum() - 10 + m
    print((int(res)))


if __name__ == "__main__":
    main()

import sys

(*T,) = list(map(int, sys.stdin.read().split()))


def main():
    res = 0
    e = 10
    for t in T:
        res += 10 * ((t + 10 - 1) // 10)
        e = min(e, (t - 1) % 10 + 1)
    res -= 10 - e
    return res


if __name__ == "__main__":
    ans = main()
    print(ans)

-import math -import numpy as np + +(*T,) = list(map(int, sys.stdin.read().split())) -    dish = np.array(sys.stdin.read().split()) -    minute = [int(dish[i][-1]) for i in range(5)] -    m = min(x for x in minute if x > 0) if minute.count(0) != 5 else 10 -    res = (np.ceil(dish.astype(np.int64) / 10) * 10).sum() - 10 + m -    print((int(res))) +    res = 0 +    e = 10 +    for t in T: +        res += 10 * ((t + 10 - 1) // 10) +        e = min(e, (t - 1) % 10 + 1) +    res -= 10 - e +    return res -    main() +    ans = main() +    print(ans)