#include <iostream>
using namespace std;
int main(){
  int T[5];
  for(int i = 0; i < 5; ++i) cin >> T[i];
  int N = 5, r = 0, ans = 0;
  for(int i = 0; i < N; ++i){
    ans += (T[i]+9)/10*10;
    r = max(r,((10-T[i]%10)%10+10)%10);
  }
  ans -= r;
  cout << ans << endl;
}
