#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) cin >> a[i];
  int min_a = 1 << 30, min_i = -1;
  for (int i = 0; i < 5; ++i) {
    if (a[i] % 10 != 0 and min_a % 10 > a[i] % 10) {
      min_a = a[i];
      min_i = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; ++i) {
    ans += a[i];
    if (ans % 10 != 0) {
      ans += (10 - ans % 10);
    }
  }
  if (min_i != -1) {
    cout << ans - 10 + a[min_i] % 10 << endl;
  } else {
    cout << ans << endl;
  }
}
