#include <bits/stdc++.h>
using namespace std;
struct pp {
  char str[20];
  bool operator<(const pp &temp) const { return strcmp(str, temp.str) < 0; }
};
pp list[65536];
char lower[110000], upper[110000];
int a, temp, init, dp[2][110000], mod = 1000000007, value[110000], n,
                                  ex[110000], ten[110000], three[110000];
long long test;
int count(char num[]) {
  int i, j, s, p, q, res = 0;
  n = strlen(num);
  for (i = 0; i < n; i++) value[i] = num[n - 1 - i] - '0' - 4;
  while (n >= 1 && value[n - 1] == 0) n--;
  dp[0][0] = (int)((long long)init * (long long)(init + 3) % mod);
  dp[1][0] = (2 * init % mod + 3) % mod;
  for (i = 1; i <= n; i++) {
    dp[0][i] = (dp[0][i - 1] << 1) % mod;
    dp[0][i] += (int)((long long)((init + three[i]) % mod) *
                      (long long)((init + ten[i]) % mod) % mod);
    dp[0][i] %= mod;
    dp[0][i] -= (int)((long long)((init + three[i - 1]) % mod) *
                      (long long)((init + ten[i - 1]) % mod) % mod);
    dp[0][i] = (dp[0][i] + mod) % mod;
    dp[0][i] += (int)((long long)ten[i - 1] * (long long)dp[1][i - 1] % mod);
    dp[0][i] %= mod;
    temp = (init << 1) % mod;
    temp = (temp + three[i - 1]) % mod;
    temp = (temp + ten[i - 1]) % mod;
    temp = (int)((long long)temp * (long long)ten[i - 1] % mod);
    dp[0][i] = (dp[0][i] - temp + mod) % mod;
    temp = (int)((long long)ten[i - 1] * (long long)ten[i - 1] % mod);
    temp =
        (int)((long long)temp * (long long)((ex[i - 1] - 1 + mod) % mod) % mod);
    dp[0][i] = (dp[0][i] + temp) % mod;
    dp[1][i] =
        (dp[1][i - 1] << 1) % mod + (int)((long long)((ex[i] - 2 + mod) % mod) *
                                          (long long)ten[i - 1] % mod);
    dp[1][i] %= mod;
    dp[1][i] = (dp[1][i] + three[i]) % mod;
    dp[1][i] = (dp[1][i] + ten[i]) % mod;
    dp[1][i] = (dp[1][i] - three[i - 1] + mod) % mod;
    dp[1][i] = (dp[1][i] - ten[i - 1] + mod) % mod;
  }
  a = 0;
  for (i = n - 1; i >= 0; i--) {
    if (value[i] == 3) {
      res = (res + dp[0][i]) % mod;
      res = (res + (int)((long long)dp[1][i] * (long long)a % mod)) % mod;
      temp = (int)((long long)a * (long long)a % mod);
      temp = (int)((long long)temp * (long long)ex[i] % mod);
      res = (res + temp) % mod;
      a = (a + ten[i]) % mod;
    }
  }
  return res;
}
int main() {
  int tst = 1000, i, j, s, p, q, res1, res2, cnt;
  while (scanf("%s%s", lower, upper) == 2) {
    n = strlen(lower);
    ex[0] = 1;
    ten[0] = 3;
    three[0] = 0;
    init = 0;
    for (i = 1; i <= n; i++) {
      init = (int)((long long)init * (long long)10 % mod);
      init = (init + 4) % mod;
      ex[i] = (ex[i - 1] << 1) % mod;
      ten[i] = (int)((long long)ten[i - 1] * (long long)10 % mod);
      three[i] = (three[i - 1] + ten[i - 1]) % mod;
    }
    printf("%d\n", (count(upper) - count(lower) + mod) % mod);
  }
  return 0;
}
