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

int main(){
	ll a[5],ans=0,num=10;
	for(int i=0;i<5;i++){
		cin>>a[i];
		ans+=(a[i]+9)/10*10;
		ll x=a[i]%10;
		if(!x)x=10;
		num=min(num,x);
	}
	ans+=num-10;
	cout<<ans;
	return 0;
}
