#include <iostream>

using namespace std;
int main(){
	int i,j,a[5],sum = 0,mx = 0;
	for(i=0;i<5;i++) cin >> a[i];
	for(i=0;i<5;i++){
		for(j=0;j<200;j+=10){
			if(j>=a[i]){
				sum += j; mx = max(mx,j - a[i]);
				break;
			}
		}
	}
	cout << sum - mx << endl;
}