#!/usr/bin/env python
# coding: utf-8

# In[8]:


import math
ds = [int(input()) for i in range(5)]
"""
29
20
7
35
120
"""


# In[9]:


s1 = [d%10 for d in ds if d%10!=0]
if s1:
    m1 = min(s1)
else:
    m1 = 0


# In[10]:


sum_ = 0
for d in ds:
    sum_ += math.ceil(d/10)*10


# In[11]:


print(sum_-10+m1)


# In[ ]:




