#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int a[5];
int b[5];
int main() {
  int ans = 0;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0) {
      ans = ans + a[i];
      b[i] = 0;
    } else {
      ans = ans + a[i] + 10 - (a[i] % 10);
      b[i] = a[i] % 10;
    }
  }
  sort(b, b + 5);
  int p = b[0];
  for (int i = 0; i < 5; i++) {
    if (p == 0) {
      p = b[i];
    } else {
      break;
    }
  }
  cout << ans - 10 + p;
}
