#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  int b[5];
  int min = 9;
  int final_i;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    int tmp = a[i] % 10;
    if (tmp < min && tmp != 0) {
      min = tmp;
      final_i = i;
    }
    if (tmp == 0)
      b[i] = a[i];
    else
      b[i] = ((a[i] / 10) + 1) * 10;
  }
  int time = 0;
  for (int i = 0; i < 5; i++) {
    if (i != final_i) time += b[i];
  }
  time += a[final_i];
  cout << time << endl;
}
