#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int cnt = 0;
  int A[5];
  cin >> A[0] >> A[1] >> A[2] >> A[3] >> A[4];
  for (int i = 0; i <= 9; i++) {
    for (int j = 0; j < 5; j++) {
      if ((10 - (A[j] % 10)) % 10 == i) {
        cnt++;
        if (cnt != 5) {
          int a = ((10 - (A[j] % 10)) % 10);
          cout << "a" << a << " A " << A[j] << " i " << i << endl;
          ans += A[j] + a;
          cout << ans << endl;
        } else {
          ans += A[j];
          cout << ans << endl;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
