#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int ans = 0;
	int mi = 10;
	for (int i = 0; i < 5; ++i) {
		int d;
		cin >> d;
		ans += (d + 9) / 10 * 10;
		if(d % 10 > 0)
			mi = min(mi, d % 10);
	}
	cout << ans - 10 + mi << endl;
	return 0;
}