#include <iostream>
using namespace std;

int main() {
	int a[5],b[5];
	int amari = 0;
	int time = 0;
	for(int i=0;i<5;i++){
		cin >> a[i];
		b[i] = (a[i]+9)/10;
		if((b[i]*10-a[i])>amari){
			amari = b[i]*10-a[i];
		}
		time = time + b[i]*10;
	}
	
	cout << time - amari << endl;
	
	
	return 0;
}