#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
using namespace std;

int main()
{
	vector<int> a(5);
	cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	int min = 0;
	int sum = 0;
	for (int i = 0; i < 5; i++) {
		min = min(a[i] % 10, min);
		sum += ((a[i] + 9) / 10) * 10;
	}
	cout << sum + min - 10 << endl;
}