#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 += ((10 - 1) * a[i] % 10 + (a[i]));
  }
  int min = a[0] % 10, t = 0;
  for (int i = 0; i < 5; i++) {
    if (min > (a[i] % 10)) {
      min = a[i] % 10;
      t = i;
    }
  }
  cout << ans - (10 - min);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
