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

int main(){
	int sum = 0, minx = 10;
	for (int i=0;i<5;i++){
		int temp;
		cin >> temp;
		sum += (temp-1)/10*10 + 10;
		if (temp%10 != 0) minx = min(minx,temp%10);
	}
	sum += minx-10;
	cout << sum;
}
