#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int xtime(int x){
    return (x+9)/10*10;
}

int ytime(int x){
    return xtime(x)-x;
}

int main(){
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    int sum=xtime(a)+xtime(b)+xtime(c)+xtime(d)+xtime(e);
    sum-=max(ytime(a),ytime(b),ytime(c),ytime(d),ytime(e));
    cout << sum << endl;
}
