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

int main(void) {
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int n = 5;

	vector<int> time[a, b, c, d, e];
	vector<int> nextTime(5);
	for (int i = 0; i < n; i++) {
		if(time[i] % 10 == 0) nextTime[i] = time[i];
		else nextTime[i] = time[i] - time[i] % 10 + 10;
		// nextTime[i] = (time[i] + 9) / 10 * 10;
	}
	int bestTime = 1e9;
	for (int i = 0; i < n; i++) {
		int sumTime = 0;
		for (int j = 0; j < n; j++) {
			if (i == j) {
				sumTime += time[j];
			} else {
				sumTime += nextTime[j];
			}
		}
		bestTime = min(bestTime, sumTime);
	}
	cout << bestTime << endl;
	return 0;
}