#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5], hoge = 9, hoge_t, T;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 5; i++) {
    if (hoge > a[i] % 10 && a[i] % 10 != 0) {
      hoge_t = i;
      hoge = a[i] % 10;
      T = a[i];
    }
  }
  a[hoge_t] = 0;
  int sum = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 != 0) {
      sum += ((a[i] / 10) + 1) * 10;
    } else {
      sum += a[i];
    }
  }
  cout << sum + T << endl;
  return 0;
}
