#include <bits/stdc++.h>
using namespace std;

int main(){
    int a,b,c,d,e,f,g,h,i,j;
    int x = 1000;
    cin >> a >> b >> c >> d >> e;
    f=(a-1)/10*10+10;
    g=(b-1)/10*10+10;
    h=(c-1)/10*10+10;
    i=(d-1)/10*10+10;
    j=(e-1)/10*10+10;
    vector<int> z(5);
    z(0)=a+g+h+i+j;
    z(1)=b+f+h+i+j;
    z(2)=c+g+f+i+j;
    z(3)=d+g+h+f+j;
    z(4)=e+g+h+i+f;
    for(int i=0;i<5;i++){
    x = min(x,z(i));
    }
    cin << x << endl;

    return 0;
    
}
