#include <bits/stdc++.h>
using namespace std;
int a[6], b[6];
int main() {
  int ma = 0;
  for (int i = 1; i <= 5; i++) {
    cin >> a[i];
    if (a[i] % 10 == 0)
      b[i] = 0;
    else
      b[i] = 10 - a[i] % 10;
    ma = max(ma, b[i]);
  }
  int ans = 0;
  int k = 0x3f3f3f3f;
  for (int i = 1; i <= 5; i++) {
    if (ma == b[i]) {
      k = a[i];
      a[i] = a[i + 1];
      continue;
    }
    if (k != 0x3f3f3f3f) {
      a[i] = a[i + 1];
    }
  }
  for (int i = 1; i <= 4; i++) {
    if (a[i] % 10 == 0)
      ans += a[i];
    else
      ans = ans + a[i] + 10 - a[i] % 10;
  }
  cout << ans + k;
  return 0;
}
