#include <bits/stdc++.h>
using namespace std;
using vi = vector<long long>;
using vvi = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
const long long inf = 100100100100;
const int Inf = 1001001001;
const int mod = 1000000007;
int main() {
  vi v(5);
  for (long long i = 0; i < (long long)(5); i++) cin >> v[i];
  int a = 10;
  int sum = 0;
  for (long long i = 0; i < (long long)(5); i++) {
    sum += v[i];
    sum += (10000 - v[i]) % 10;
    if (a > v[i] % 10) a = v[i] % 10;
  }
  cout << sum + a - 10 << endl;
}
