#include <bits/stdc++.h>
using namespace std;
long long n;
const long long N = 1e5 + 100;
const long long mod = 1e9 + 7;
long long a[N], dp[N][2], sum[N], four[N], seven[N], ten[N], two[N];
long long mul(long long x, long long y) { return (x % mod) * (y % mod) % mod; }
long long sq(long long x) { return mul(x, x); }
string st1, st2;
long long calc(string &st) {
  for (long long i = 1; i <= n; i++) a[i] = st[i - 1] - '0';
  reverse(a + 1, a + 1 + n);
  long long r = 0, ans = 0;
  for (long long i = n; i >= 1; i--) {
    if (a[i] == 4) {
      r = (r * 10 + a[i]) % mod;
      continue;
    }
    ans = (ans + mul((r * 10 + 4) % mod * ten[i - 1] + seven[i - 1],
                     (r * 10 + 7) % mod * ten[i - 1] + four[i - 1])) %
          mod;
    r = (r * 10 + 4) % mod;
    ans = (ans + dp[i - 1][1] +
           mul(r * ten[i - 1], sum[i - 1] * 2 - four[i - 1] - seven[i - 1]) +
           mul(sq(r * ten[i - 1]), two[i - 1] - 1)) %
          mod;
    r = r + 3;
  }
  return ans;
}
signed main() {
  cin >> st1 >> st2;
  n = st1.length();
  four[0] = 0;
  for (long long i = 1; i <= n; i++) four[i] = (four[i - 1] * 10 + 4) % mod;
  seven[0] = 0;
  for (long long i = 1; i <= n; i++) seven[i] = (seven[i - 1] * 10 + 7) % mod;
  two[0] = 1;
  for (long long i = 1; i <= n; i++) two[i] = (two[i - 1] * 2) % mod;
  ten[0] = 1;
  for (long long i = 1; i <= n; i++) ten[i] = (ten[i - 1] * 10) % mod;
  sum[0] = 0;
  for (long long i = 1; i <= n; i++)
    sum[i] = (four[i] + seven[i]) * (two[i - 1]) % mod;
  for (long long i = 1; i <= n; i++) {
    dp[i][0] = (dp[i - 1][1] +
                mul(sum[i - 1] * 2 - four[i - 1] - seven[i - 1] + mod * 2,
                    4 * ten[i - 1]) +
                mul(sq(4 * ten[i - 1]), two[i - 1] - 1)) %
               mod;
    dp[i][1] =
        (dp[i][0] + dp[i - 1][1] +
         mul(sum[i - 1] * 2 - four[i - 1] - seven[i - 1] + mod * 2,
             7 * ten[i - 1]) +
         mul(sq(7 * ten[i - 1]), two[i - 1] - 1) +
         mul(4 * ten[i - 1] + seven[i - 1], 7 * ten[i - 1] + four[i - 1])) %
        mod;
  }
  long long ans1 = calc(st2), ans2 = calc(st1);
  cout << (ans1 - ans2 + mod) % mod << endl;
  return 0;
}
