#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b);
int main() {
  int ans = 0;
  vector<int> a(10);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    ans += (((a[i]) + 9) / 10 * 10);
  }
  int min = (a[0]) % 10, t = 0;
  for (int i = 0; i < 5; i++) {
    if (min > ((a[i] + 9) % 10)) {
      min = (a[i] + 9) % 10;
      t = i;
    }
  }
  if (a[t] == 0)
    cout << ans << endl;
  else
    cout << ans - (10 - a[t] % 10);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
