#include <iostream>
using namespace std;
int a[9], b, sum, mx;
int main() {
	for(int i=0; i<5; i++) {
		cin>>a[i];
		b = (a[i]+9) / 10 * 10;
		sum += b;
		mx = max(mx, b - a[i]);
	}
	cout<<sum - mx;
	return 0;
}