#include <bits/stdc++.h>
using namespace std;
int num[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
long long getTime(long long n, long long k) {
  long long ret = 0;
  if (n == 0) {
    if (k == 0)
      return 1;
    else
      return 0;
  } else {
    int bef = n / 10;
    int cur = n % 10;
    int aft = 0;
    if (k == 0) {
      ret = 1;
      for (int i = 0; i <= n; i++) {
        int tmp = i;
        while (tmp) {
          if (tmp % 10 == 0) ret += 1;
          tmp /= 10;
        }
      }
    } else {
      for (int i = 1; n / i != 0; i *= 10) {
        if (k < cur)
          ret += (bef + 1) * i;
        else if (k == cur)
          ret += bef * i + aft + 1;
        else
          ret += bef * i;
        aft += cur * i;
        cur = bef % 10;
        bef /= 10;
      }
    }
  }
  return ret;
}
long long Ans(long long n) {
  long long ret = 0;
  for (int k = 0; k < 10; k++) ret += getTime(n, k) * num[k];
  return ret;
}
int main() {
  long long a, b;
  cin >> a >> b;
  a--;
  cout << (Ans(b) - Ans(a)) << endl;
  return 0;
}
