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

const int N=105;
int n,a[N];

int main()
{
	n=5;int i,delt=0,ret=0;
	for(i=1;i<=n;++i)
	{
		scanf("%d",&a[i]);
		int now=a[i]/10*10;
		if(now<a[i]) now+=10;
		ret+=now,delt=max(delt,now-a[i]);
	}
	printf("%d\n",ret-delt);
	return 0;
}