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

int main() {
  int sum = 0;
  int x = 10;
  for (int i = 0; i < 5; i++) {
      int A;
      cin >> A;
      if(A%10==0) {
          sum += A;
          continue;
      }
      sum += A/10*10+10;
      x = min(x, A%10);
  }
  cout << sum - 10 + x << endl;
}