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

int main() {
	int n = 5;
	int max = 0;
	int sum = 0;
	for (int i = 0, x; i < n; i++) {
		cin >> x;
		sum += (x + 9) / 10;
		if (9 - (x + 9) % 10 > max)
			max = 9 - (x + 9) % 10;
	}
	cout << sum * 10 - max << endl;
}

