#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main(){
  int x,sum=0,last=0;
  for(int i=0;i<5;i++){
    cin>>x;
    sum=sum+((x+9)/10)*10;
    if(x%10==0)
      continue;
    last=max(last,10-x%10);
  }
  cout<<sum-last;
  return 0;
}