#include <bits/stdc++.h>
using namespace std;

signed main() {
	vector<int> a(5), b(5);
	for (int i = 0; i < 5; ++i) {
		cin >> a[i];
		while (a[i] % 10 != 0) {
			a[i]++;
			b[i]++;
		}
	}

	sort(b.begin(), b.end());

	cout << accumulate(a.begin(), a.end(), 0) - b[4] << endl;
}

