#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int A, B, C, D, E;
  cin >> A >> B >> C >> D >> E;
  int a = (A + 9) / 10;
  int b = (B + 9) / 10;
  int c = (C + 9) / 10;
  int d = (D + 9) / 10;
  int e = (E + 9) / 10;
  if ((A %= 10) == 0) A = 9;
  if ((B %= 10) == 0) B = 9;
  if ((C %= 10) == 0) C = 9;
  if ((D %= 10) == 0) D = 9;
  if ((E %= 10) == 0) E = 9;
  cout << (a + b + c + d + e) * 10 + min({A, B, C, D, E}) - 10 << endl;
  return 0;
}
