#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
  int a[4];
  int m,mx=0,sum=0;
  rep(i,5){
    cin>>a[i];
    if(a[i]%10==0)m=0;
	else m = 10-a[i]%10;
    mx = max(mx,m);
    sum += a[i]+m;
  }
	cout<<sum-mx;
}