#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int sum = 0;
  int min = 9;
  int rec;
  int rec2;
  int rec3;
  int a[5] = {A, B, C, D, E};
  for (int i = 0; i < 5; i++) {
    if (min > a[i] % 10) {
      if (a[i] % 10 != 0) {
        min = a[i] % 10;
        rec = i;
        rec2 = a[i];
      }
    }
  }
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 != 0) {
      sum += (a[i] / 10 + 1) * 10;
      a[i] = 0;
    }
    sum += a[i];
  }
  cout << sum - (rec2 / 10 + 1) * 10 + rec2;
}
