#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 0x3f3f3f3f;
const long long MOD = 1e9 + 7;
long long n, sum[100002][2], sqsum[100002][2], cnt[100002][2], all_7[100002],
    s[100002], ten[200002];
long long solve(string str) {
  n = str.length();
  memset(all_7, 0, sizeof(all_7));
  memset(sum, 0, sizeof(sum)), memset(sqsum, 0, sizeof(sqsum)),
      memset(cnt, 0, sizeof(cnt));
  cnt[0][1] = 1;
  all_7[n + 1] = 1;
  for (long long i = n; i >= 1; --i)
    all_7[i] = all_7[i + 1] & (str[i - 1] == '7');
  long long rest = 0;
  for (long long i = 1; i <= n; ++i) {
    long long num = str[i - 1] ^ 48;
    for (long long j = 0; j < 2; ++j) {
      for (long long jj = 4; jj <= 7; jj += 3) {
        if (j && (jj > num)) break;
        long long new_j = j & (jj == num);
        (cnt[i][new_j] += cnt[i - 1][j]) %= MOD;
        (sum[i][new_j] +=
         (1ll * cnt[i - 1][j] * jj % MOD + 10ll * sum[i - 1][j])) %= MOD;
        (sqsum[i][new_j] +=
         (100ll * sqsum[i - 1][j] + 20ll * jj * sum[i - 1][j] +
          1ll * jj * jj * cnt[i - 1][j])) %= MOD;
      }
    }
    long long tmp = 0, A, B;
    bool smaller = (str[i - 1] == '7');
    A = 7ll * ten[n - i] % MOD + 4ll * s[n - i] % MOD;
    A %= MOD;
    B = 4ll * ten[n - i] % MOD + 7ll * s[n - i] % MOD;
    B %= MOD;
    long long Sum = sum[i - 1][0], Sqsum = sqsum[i - 1][0], Cnt = cnt[i - 1][0];
    if (smaller) {
      Sum += sum[i - 1][1], Sqsum += sqsum[i - 1][1], Cnt += cnt[i - 1][1];
      Sum %= MOD, Sqsum %= MOD, Cnt %= MOD;
    }
    (tmp += (1ll * Sqsum * ten[(n - i + 1) * 2] % MOD)) %= MOD;
    (tmp +=
     (1ll * Sum * A % MOD + 1ll * Sum * B % MOD) * ten[n - i + 1] % MOD) %= MOD;
    (tmp += 1ll * A * B % MOD * Cnt % MOD) %= MOD;
    (rest += tmp) %= MOD;
  }
  return rest;
}
signed main() {
  ios::sync_with_stdio(false);
  string l, r;
  s[0] = 0;
  s[1] = 1;
  ten[0] = 1;
  ten[1] = 10;
  for (long long i = 2; i <= 100000; ++i) s[i] = (10ll * s[i - 1] + 1) % MOD;
  for (long long i = 2; i <= 200000; ++i) ten[i] = (10ll * ten[i - 1]) % MOD;
  cin >> l >> r;
  cout << (solve(r) - solve(l) + MOD) % MOD << endl;
  return 0;
}
