#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a, b, c, d, e, ans, at;
  cin >> a >> b >> c >> d >> e;
  if (a % 10 != 0) {
    for (int i = 0; 1; i++) {
      if (a / 10 < i) {
        at = i * 10;
        break;
      }
    }
  } else {
    at = a;
  }
  ans += at + b;
  if (ans % 10 != 0) {
    for (int i = 0; 1; i++) {
      if (ans / 10 < i) {
        ans = i * 10;
        break;
      }
    }
  }
  ans += c;
  if (ans % 10 != 0) {
    for (int i = 0; 1; i++) {
      if (ans / 10 < i) {
        ans = i * 10;
        break;
      }
    }
  }
  ans += d;
  if (ans % 10 != 0) {
    for (int i = 0; 1; i++) {
      if (ans / 10 < i) {
        ans = i * 10;
        break;
      }
    }
  }
  ans += c;
  cout << ans << endl;
}
