#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int ans = a + b + c + d + e;
  vector<int> amari;
  if (a % 10 != 0) {
    amari.push_back(10 - a % 10);
  }
  if (b % 10 != 0) {
    amari.push_back(10 - b % 10);
  }
  if (c % 10 != 0) {
    amari.push_back(10 - c % 10);
  }
  if (d % 10 != 0) {
    amari.push_back(10 - d % 10);
  }
  if (e % 10 != 0) {
    amari.push_back(10 - e % 10);
  }
  sort(amari.begin(), amari.end());
  for (int i = 0; i < amari.size() - 1; i++) {
    ans += amari[i];
  }
  cout << ans << endl;
  return 0;
}
