#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;
int main() {
	vector<int>a(5);
	for(auto &e:a)cin>>e;

	int min_=644;
	for(int i=0; i<5; ++i) {
		int ans=0;
		for(int j=0; j<5;++j) {
			if(i==j)continue;
			ans+=ceil((double)a[j]/10.0)*10;
		}
		min_=min(min_, ans+a[i]);
	}
	cout<<min_<<endl;

	return 0;
}