#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int a[5] = {}, m = 10, res = 0;
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
    if (a[i] % 10 != 0) m = min(m, a[i] % 10);
    res += a[i] / 10 + ((a[i] % 10 == 0) ? 0 : 1);
  }
  res = res * 10 + m % 10 - 10;
  cout << res << endl;
  return 0;
}
