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

# In[13]:


abcde = []
for _ in range(5):
    abcde.append(int(input()))
print(sum(-(-x//10)*10 for x in abcde) + min(x%10 for x in abcde if x%10 != 0) - 10)


# In[ ]:




