    #include <bits/stdc++.h>
    #define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
    #define ll long long int
    #define ld long double
    #define f(a, b) for (ll i = a; i < b; i++)
    #define in(a, b) (b.find(a) != string::npos)
    #define X first
    #define Y second
    #define vi vector<int>
    #define fill(a, x) memset(a, x, sizeof(a))
    #define pb push_back
    #define pf push_front
    #define mp make_pair
    #define all(v) v.begin(), v.end()
    #define el "\n"
    const ll M = 1e9 + 7;
    using namespace std;

    int main() {
    fio;
    int n=5;
    int a[n]={0};
    ll sm=0;
    vector<pair<int,int>> v;
    for(int i=0;i<n;i++){
        cin>>a[i];
        v.pb(mp((10-a[i])%10,i));
    }
    sort(all(v));
    for(int i=0;i<n;i++){
        sm+=a[v[i].Y];
        if(sm%10!=0 && i!=n-1){
            while(sm%10!=0)sm++;
        }
    }
    cout<<sm<<el;
    return 0;
    }
