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

int main(){
    vector<int> A(5);
    for (int i=0;i<5;i++){
        cin >> A[i];
    }

    int ans = 0, m = 0;
    for(int i=0;i<5;i++){
        ans += A[i] + (10-A[i]%10)%10;
        m = max(m, (10-A[i]%10)%10);
    }
    cout << ans - m << endl;
}