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

int main(){
    int a[5];
    for(int i = 0; i < 5; i++) cin >> a[i];
    int sum = 0, MAX = 0;
    for(int i = 0; i < 5; i++){
        int tmp = (a[i] + 9) / 10 * 10;
        sum += tmp;
        MAX = max(MAX, tmp - a[i]);
    }
    cout << sum - MAX << endl;
}