#include <bits/stdc++.h>
using namespace std;
long long dp[500000][3];
long long sum[500000][3];
long long lg[500000][3];
long long cnt[500000][3];
int D[500000];
long long pw(int b, int p) {
  if (p == 0) return 1;
  long long ans = pw(b, p / 2);
  ans *= ans;
  ans %= 1000000007ll;
  if (p % 2) ans *= b;
  ans %= 1000000007ll;
  return ans;
}
void solve(int n, int eq) {
  assert(n >= 0);
  if (dp[n][eq] >= 0) return;
  if (n == 0) {
    bool cando7 = (D[n] == 7 || !eq);
    if (cando7) {
      cnt[n][eq] = 2;
      lg[n][eq] = 7;
      sum[n][eq] = 7 + 4;
      dp[n][eq] = 7 * 4;
    } else {
      cnt[n][eq] = 1;
      lg[n][eq] = 4;
      sum[n][eq] = 0;
      dp[n][eq] = 0;
    }
    return;
  }
  dp[n][eq] = 0;
  sum[n][eq] = 0;
  cnt[n][eq] = 0;
  lg[n][eq] = 0;
  for (int dig = 4; dig <= 7 && (dig <= D[n] || !eq); dig += 3) {
    int neweq = eq && (dig == D[n]);
    solve(n - 1, neweq);
    cnt[n][eq] += cnt[n - 1][neweq];
    cnt[n][eq] %= 1000000007ll;
    long long adder = dig * pw(10, n) % 1000000007ll;
    lg[n][eq] = adder + lg[n - 1][neweq];
    lg[n][eq] %= 1000000007ll;
    assert(cnt[n - 1][neweq] >= 1);
    if (cnt[n - 1][neweq] == 1)
      assert(dp[n - 1][neweq] == 0 && sum[n - 1][neweq] == 0);
    dp[n][eq] += (((adder * adder) % 1000000007ll) *
                  (cnt[n - 1][neweq] + 1000000007ll - 1) % 1000000007ll) %
                     1000000007ll +
                 adder * sum[n - 1][neweq] % 1000000007ll +
                 dp[n - 1][neweq] % 1000000007ll;
    dp[n][eq] %= 1000000007ll;
    sum[n][eq] += adder * 2 % 1000000007ll *
                      (cnt[n - 1][neweq] + 1000000007ll - 1) % 1000000007ll +
                  sum[n - 1][neweq] % 1000000007ll;
    sum[n][eq] %= 1000000007ll;
  }
  if (D[n] == 7 || !eq) {
    long long val = (7 * pw(10, n) % 1000000007ll +
                     ((((pw(10, n) + 1000000007ll - 1) * 4) % 1000000007ll *
                       pw(9, 1000000007ll - 2) % 1000000007ll) %
                      1000000007ll)) %
                    1000000007ll;
    long long val2 =
        (4 * pw(10, n) % 1000000007ll + lg[n - 1][0]) % 1000000007ll;
    assert(lg[n - 1][0] > 0 && cnt[n - 1][0] > 1);
    dp[n][eq] += val % 1000000007ll * val2 % 1000000007ll;
    sum[n][eq] += (val + val2) % 1000000007ll;
    dp[n][eq] %= 1000000007ll;
    sum[n][eq] %= 1000000007ll;
  }
}
char l[500000], r[500000];
int main() {
  scanf("%s%s", l, r);
  int n = strlen(l);
  assert(n < 500000);
  long long lval = 0;
  for (int i = 0; i < n; ++i) D[n - 1 - i] = l[i] - '0';
  memset(sum, -1, sizeof(sum));
  memset(dp, -1, sizeof(dp));
  memset(lg, -1, sizeof(lg));
  memset(cnt, -1, sizeof(cnt));
  solve(n - 1, 1);
  lval = dp[n - 1][1];
  long long rval = 0;
  for (int i = 0; i < n; ++i) D[n - 1 - i] = r[i] - '0';
  memset(sum, -1, sizeof(sum));
  memset(dp, -1, sizeof(dp));
  memset(lg, -1, sizeof(lg));
  memset(cnt, -1, sizeof(cnt));
  solve(n - 1, 1);
  rval = dp[n - 1][1];
  long long ans = (rval - lval + 1000000007ll) % 1000000007ll;
  cout << ans << endl;
}
