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

int main() {
	int a[5], b[5], count = 0;
	bool check = true;
	for (int i = 0; i < 5; i++) {
		cin >> a[i];
		if (a[i] % 10 == 0) count += a[i];
		else count += (a[i] / 10) * 10 + 10;
		b[i] = 9 - (a[i]  - 1) % 10;
	}
	sort(b, b + 5);
	cout << count - b[4];
}