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

int x,ans,minn;
int main()
{
	minn=9999999;
	for (int i=1; i<=5; i++)
	{
		cin>>x;
		ans+=(x/10);
		if (x%10!=0) ans++,minn=min(minn,x%10);
	}
	if (minn!=9999999) ans=(ans-1)*10+minn;
	else ans=ans*10;
	cout<<ans;
	return 0;
}