#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int main() {
  vector<int> A(5);
  int ans = 0;
  int a = 11;
  int b = 0;
  for (int i = 0; i < (int)(5); i++) {
    cin >> A[i];
    ans += A[i];
    b = A[i] % 10;
    if (b == 0) {
      b += 10;
    }
    if (b < a) {
      a = b;
    }
  }
  if (a == 0) {
    a = 0;
  }
  cout << ans - a << endl;
}
