#include <bits/stdc++.h>
using namespace std;
string n, m;
int x, y, z;
int main() {
  cin >> n >> m;
  while (n != m) {
    x = 0;
    z = 0;
    for (int i = 0; i < n.size(); i++) {
      if (n[i] == '1')
        y += 2;
      else if (n[i] == '7')
        y += 3;
      else if (n[i] == '4')
        y += 4;
      else if (n[i] == '2' || n[i] == '3' || n[i] == '5')
        y += 5;
      else if (n[i] == '0' || n[i] == '6' || n[i] == '9')
        y += 6;
      else if (n[i] == '8')
        y += 7;
    }
    if (n[n.size() - 1] == '9') {
      for (int i = n.size() - 2; i >= 0; i--) {
        if (n[i] != '9') {
          n[i]++;
          x++;
          for (int j = i + 1; j < n.size(); j++) n[j] = '0';
          break;
        }
      }
      if (x == 0) {
        for (int i = 0; i < n.size(); i++) n[i] = '0';
        n[0] = '1';
        n += '0';
      }
    } else
      n[n.size() - 1]++;
  }
  for (int i = 0; i < n.size(); i++) {
    if (n[i] == '1')
      y += 2;
    else if (n[i] == '7')
      y += 3;
    else if (n[i] == '4')
      y += 4;
    else if (n[i] == '2' || n[i] == '3' || n[i] == '5')
      y += 5;
    else if (n[i] == '0' || n[i] == '6' || n[i] == '9')
      y += 6;
    else if (n[i] == '8')
      y += 7;
  }
  cout << y;
  return 0;
}
