#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
bool f(int l, int r){
    return l%10 > r%10;
}
int main(){
    vector<int> a;
    for(int i = 0; i < 5; i++){#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
bool f(int l, int r){
    return l%10 > r%10;
}
int main(){
    vector<int> a;
    for(int i = 0; i < 5; i++){
        int x;
         cin >> x;
         a.pb(x);
    }
    int s = 0;
    for(int i = 0; i < a.size(); i++){
       if(a[i]%10 == 0) {
           s += a[i];
           a.erase(a.begin() + i);
           i--;
       }
    }
    if(a.size() != 0) {
        sort(a.begin(), a.end(), f);
    for(int i = 0; i < a.size()-1; i++){
        s += a[i] + 10 - a[i]%10;        
    }
        cout << s + a[a.size()-1];
    }
    else cout << s;
}
        int x;
         cin >> x;
         a.pb(x);
    }
    int s = 0;
    for(int i = 0; i < 5; i++){
       if(a[i]%10 == 0) s += a[i];
    }
    sort(a.begin(), a.end(), f);
    a.pb(0);
    for(int i = 0; i < 5; i++){
        if(a[i+1]%10 != 0) s += a[i] / 10 * 10 + 10;
        else{
            s += a[i];
            break;
        }
    }
    cout << s;
}