#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, D, E, res;
  int ryo[5];
  int amari[5];
  int min_index = 999;
  int min = 10;
  for (int i = (0), iLen_ = (5); i < iLen_; i++) {
    cin >> ryo[i];
    amari[i] = ryo[i] % 10;
    if (amari[i] < min && amari[i] != 0) {
      min = ryo[i];
      min_index = i;
    }
  }
  res = 0;
  for (int i = (0), iLen_ = (5); i < iLen_; i++) {
    res += ryo[i];
    if (i != min_index && amari[i] != 0) {
      res += 10 - amari[i];
    }
  }
  cout << res << endl;
}
