#include <bits/stdc++.h>
using namespace std;
int f(int x) {
  return ((x - 1) / 10 + 1) * 10;
}
int main() {
  vector T(5);
  for(int i = 0; i < 5; i++) {
    cin >> T[i];
  }
  int sum = f(A) + f(B) + f(C) + f(D) + f(E);
  int min_time = sum;
  for(int i = 0; i < 5; i++) {
    if(T[i] % 10 != 0) {
      int real = sum + T[i] % 10 - 10;
    }
    if(real < min_time) {
      min_time = real;
    }
  }
  cout << min_time << endl;
}
}