a = []

for _ in range(5):

    x = int(eval(input()))

    a.append(x if x>= 40 else 40)

print((sum(a)//5))
scores = [int(eval(input())) for _ in range(5)]

print((sum([(score < 40) * 40 + (score >= 40) * score for score in scores]) // 5))
a = []
for _ in range(5):
    x = int(eval(input()))
    a.append(x if x >= 40 else 40)
print((sum(a) // 5))

scores = [int(eval(input())) for _ in range(5)]
print((sum([(score < 40) * 40 + (score >= 40) * score for score in scores]) // 5))

-a = [] -for _ in range(5): -    x = int(eval(input())) -    a.append(x if x >= 40 else 40) -print((sum(a) // 5)) +scores = [int(eval(input())) for _ in range(5)] +print((sum([(score < 40) * 40 + (score >= 40) * score for score in scores]) // 5))