#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
unsigned GetDigit(unsigned num) { return std::to_string(num).length(); }
int tow(int n) {
  if (n == 0) return 1;
  int x = tow(n / 2);
  x *= x;
  if (n % 2 == 1) x *= 2;
  return x;
}
int KETA(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
unsigned ND(unsigned num) { return std::to_string(num).length(); }
bool KIBN(string s) {
  for (int i = 0; i < s.size() / 2; i++) {
    if (s[i] != s[s.size() - 1 - i]) return false;
  }
  return true;
}
bool INTE(double n) {
  if (ceil(n) == floor(n)) {
    return true;
  } else
    return false;
}
bool KISU(int n) {
  if (n % 2 == 0)
    return false;
  else
    return true;
}
bool GUSU(int n) {
  if (n % 2 == 0)
    return true;
  else
    return false;
}
int xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = 0;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> a(5);
  for (int i = 0; i < 5; i++) {
    cin >> a[i];
  }
  int y = 11;
  int cnt = 0;
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 < y && a[i] % 10 != 0) {
      y = a[i] % 10;
      cnt = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == cnt) {
      ans += a[i];
    } else {
      for (int j = 0; j < 9; j++) {
        if ((a[i] + j) % 10 == 0) {
          ans += (a[i] + j);
          break;
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
