#include <bits/stdc++.h>
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main() {
  int a, b, c, d, e, f;
  int A[2000001] = {};
  int B[2000001] = {};
  int ans[100003] = {};
  int sum[100003] = {};
  int cnt_flag[100003] = {};
  int L[1003] = {};
  long long JPY;
  double BTC;
  char s[200001] = {};
  char t[200001] = {};
  char u[200001] = {};
  int i, j, k;
  int flag = 0;
  int tmp = 0;
  long long min = 10000000001;
  int len = 0;
  int cnt = 0;
  int cnt0 = 0;
  int cnt1 = 0;
  int num = 0;
  int max = 0;
  scanf("%d", &a);
  tmp = a % 10;
  cnt = cnt + a / 10;
  if (tmp != 0) {
    cnt++;
    if ((tmp < min)) min = tmp;
  }
  scanf("%d", &b);
  tmp = b % 10;
  cnt = cnt + b / 10;
  if (tmp != 0) {
    cnt++;
    if ((tmp < min)) min = tmp;
  }
  scanf("%d", &c);
  tmp = c % 10;
  cnt = cnt + c / 10;
  if (tmp != 0) {
    cnt++;
    if ((tmp < min)) min = tmp;
  }
  scanf("%d", &d);
  tmp = d % 10;
  cnt = cnt + d / 10;
  if (tmp != 0) {
    cnt++;
    if ((tmp < min)) min = tmp;
  }
  scanf("%d", &e);
  tmp = e % 10;
  cnt = cnt + e / 10;
  if (tmp != 0) {
    cnt++;
    if ((tmp < min)) min = tmp;
  }
  printf("%d\n", (cnt - 1) * 10 + min);
  return 0;
}
