#include<bits/stdc++.h>

using namespace std;

int main(){
  int a,b,c,d,e;
  cin >> a >> b >> c >> d >> e;

  vector<int> Time = { a, b, c, d, e };

  vector<int> NextTime(N);

  for(int i = 0; i < N; i++){
    if(Time[i] % 10 != 0){ NextTime[i] = Time[i] - Time[i] % 10 + 10; }
    else{ NextTime[i] = Time[i]; }
  }

  int BestTime = 99999999;
  int sum = 0;
  for(int i = 0; i < 5; i++){
    sum += NextTime[i];
  }

  for(int i = 0; i < N; i++){
    sum -= NextTime[i];
    sum += Time[i];

    if(sum < BestTime) BestTime = sum;
    sum -= Time[i];
    sum += NextTime[i];
  }

  cout << BestTime << endl;

  return 0;

}
