#include <bits/stdc++.h>
using namespace std;
const int MaxN = 200005;
const double eps = 1e-7;
const double DINF = 1e100;
const int INF = 1000000006;
const long long LINF = 1000000000000000005ll;
const int MOD = 1000000007;
int n;
int a[MaxN];
char s[MaxN];
long long sumsqr[MaxN], sum[MaxN], cnt[MaxN];
long long f74[MaxN], f47[MaxN], powe[MaxN];
long long calc() {
  memset(sumsqr, 0, sizeof sumsqr);
  memset(sum, 0, sizeof sum);
  memset(cnt, 0, sizeof cnt);
  long long res = 0, up = 0;
  for (int i = n; i >= 1; --i) {
    long long sumsqr, sum, cnt;
    sumsqr = ::sumsqr[i + 1];
    sum = ::sum[i + 1];
    cnt = ::cnt[i + 1];
    long long a, b;
    a = f74[i];
    b = f47[i];
    res += sumsqr + (a + b) * sum + cnt * a % MOD * b;
    res %= MOD;
    a = 4 * powe[i] % MOD;
    b = 7 * powe[i] % MOD;
    sumsqr = (2 * sumsqr + 2 * (a + b) % MOD * sum +
              (a * a % MOD + b * b % MOD) % MOD * cnt % MOD) %
             MOD;
    sum = (2 * sum + (a + b) * cnt % MOD) % MOD;
    cnt = 2 * cnt % MOD;
    a = f74[i];
    b = f47[i];
    if (::a[i] == 7) {
      long long tmp = (up + 4 * powe[i]) % MOD;
      ++cnt;
      cnt %= MOD;
      sum = (sum + tmp) % MOD;
      sumsqr = (sumsqr + tmp * tmp) % MOD;
      res += (up + a) % MOD * ((up + b) % MOD) % MOD;
      res %= MOD;
    }
    up = (up + ::a[i] * powe[i]) % MOD;
    ::sumsqr[i] = sumsqr;
    ::sum[i] = sum;
    ::cnt[i] = cnt;
  }
  return res;
}
void init() {
  powe[1] = 1;
  for (int i = 2; i <= 100000; ++i) powe[i] = powe[i - 1] * 10 % MOD;
  f74[1] = 7;
  for (int i = 2; i <= 100000; ++i) {
    f74[i] = f74[i - 1] - 3 * powe[i - 1];
    f74[i] = (f74[i] % MOD + MOD) % MOD;
    f74[i] += 7 * powe[i];
    f74[i] %= MOD;
  }
  f47[1] = 4;
  for (int i = 2; i <= 100000; ++i) {
    f47[i] = f47[i - 1] + 3 * powe[i - 1] % MOD;
    f47[i] += 4 * powe[i];
    f47[i] %= MOD;
  }
}
int main() {
  init();
  scanf("%s", s + 1);
  n = strlen(s + 1);
  reverse(s + 1, s + n + 1);
  for (int i = 1; i <= n; ++i) a[i] = s[i] - '0';
  long long l = calc();
  scanf("%s", s + 1);
  n = strlen(s + 1);
  reverse(s + 1, s + n + 1);
  for (int i = 1; i <= n; ++i) a[i] = s[i] - '0';
  long long r = calc();
  cout << (r - l + MOD) % MOD << endl;
  return 0;
}
