#include <algorithm>
#include <iostream>
using namespace std;
int main() {
    int time=0, ma=-1;
    for(int i=1; i<=5; ++i) {
        int dish; cin>>dish;
        int wait= (dish+9) /10*10;
        time+= wait;
        ma = max(ma, wait-dish);
    }
    cout<< time-ma <<endl;
}