#include <bits/stdc++.h>

using namespace std;

int main() {
	int r = 0, m = 0;
	for (int i = 0; i < 5; i++) {
		int a;
		cin >> a;
		int b = (a + 9) / 10 * 10;
		r += b;
		m = max(m, b - a);
	}
	cout << r - m << endl;
	return 0;
}
