#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;
const int MOD = 1000000007;
int gcd(int a, int b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
bool is_prime(long long N) {
  if (N == 1) return false;
  for (long long i = 2; i * i <= N; ++i) {
    if (N % i == 0) return false;
  }
  return true;
}
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int t[5];
  t[0] = a % 10;
  t[1] = b % 10;
  t[2] = c % 10;
  t[3] = d % 10;
  t[4] = e % 10;
  int mini = INF, cnt = 0;
  for (int i = (0); i < (5); ++i) {
    if (t[i] == 0) {
      cnt++;
    } else
      mini = min(mini, t[i]);
  }
  a -= t[0];
  b -= t[1];
  c -= t[2];
  d -= t[3];
  e -= t[4];
  cout << a + b + c + d + e + ((5 - cnt - 1) * 10) + mini << endl;
}
