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