#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[5];
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  int swap;
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    if (a[i] % 10 > a[i + 1] % 10) swap = a[i];
  }
  for (int i = 0; i < 4; i++) {
    if (a[i] == swap) {
      a[i] = a[4];
      a[4] = swap;
    }
    while (a[i] % 10 != 0) a[i]++;
  }
  for (int i = 0; i < 5; i++) {
    ans += a[i];
  }
  cout << ans << endl;
  return 0;
}
