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

int main() {
  int mn = 200;
  int sum = 0;
  for(int i = 0; i < 5; ++i){
    int k;
    cin >> k;
    sum += ((k + 9) / 10) * 10;
    if(k % 10 == 0) mn = min(mn, 10);
    else mn = min(mn, k % 10);
  }
  
  cout << sum + mn - 10<< endl;
}