#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
const int MOD = 1000000007;
char l[MAXN], r[MAXN];
char *sl, *sr;
long long ans_len[MAXN];
long long sum1_len[MAXN];
long long sum2_len[MAXN];
long long all4[MAXN];
long long all7[MAXN];
long long ten[MAXN], two[MAXN];
void init() {
  all4[0] = all7[0] = 0;
  ten[0] = two[0] = 1;
  for (int i = 1; i < MAXN; i++) {
    all4[i] = ((long long)all4[i - 1] * 10 + 4) % MOD;
    all7[i] = ((long long)all7[i - 1] * 10 + 7) % MOD;
    ten[i] = (long long)ten[i - 1] * 10 % MOD;
    two[i] = (long long)two[i - 1] * 2 % MOD;
  }
  ans_len[1] = 4 * 7;
  sum1_len[1] = 7;
  sum2_len[1] = 4;
  for (int i = 2; i < MAXN; i++) {
    sum1_len[i] =
        ((long long)sum1_len[i - 1] * 2 +
         (4LL * ten[i - 1] % MOD * (two[i - 1] - 1 + MOD) % MOD) % MOD +
         (7LL * ten[i - 1] % MOD * two[i - 1] % MOD) % MOD + all4[i - 1]) %
        MOD;
    sum2_len[i] =
        ((long long)sum2_len[i - 1] * 2 +
         (4LL * ten[i - 1] % MOD * two[i - 1] % MOD) % MOD +
         (7LL * ten[i - 1] % MOD * (two[i - 1] - 1 + MOD) % MOD) % MOD +
         all7[i - 1]) %
        MOD;
    ans_len[i] = ((long long)(4 * 4 + 7 * 7) *
                      ((long long)ten[i - 1] % MOD * ten[i - 1] % MOD) % MOD *
                      (two[i - 1] - 1 + MOD) % MOD +
                  (4LL + 7LL) * ten[i - 1] % MOD *
                      (sum1_len[i - 1] + sum2_len[i - 1]) % MOD +
                  2 * ans_len[i - 1] % MOD +
                  (4LL * ten[i - 1] + all7[i - 1]) % MOD *
                      (7LL * ten[i - 1] + all4[i - 1]) % MOD) %
                 MOD;
  }
}
int brute(int x) {
  long long ans = 0;
  for (int i = 0; i < (1 << (x)) - 1; i++) {
    long long tmp1 = 0, tmp2 = 0;
    for (int j = 0; j < x; j++) {
      if ((i >> j) & 1) {
        tmp1 = (tmp1 + 7 * ten[j]) % MOD;
      } else {
        tmp1 = (tmp1 + 4 * ten[j]) % MOD;
      }
      if (((i + 1) >> j) & 1) {
        tmp2 = (tmp2 + 7 * ten[j]) % MOD;
      } else {
        tmp2 = (tmp2 + 4 * ten[j]) % MOD;
      }
    }
    cout << x << ' ' << tmp1 << ' ' << tmp2 << endl;
    ans = ((long long)ans + (long long)tmp1 % MOD * tmp2 % MOD) % MOD;
  }
  cout << ans_len[x] << endl;
  return (int)ans;
}
int gao(char *s) {
  int n = strlen(s);
  int r = 0;
  long long prefix = 0, t_prefix;
  long long ret = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '4') {
      prefix = ((long long)prefix * 10 + 4) % MOD;
    } else if (s[i] == '7') {
      t_prefix = ((long long)prefix * 10 + 7) % MOD;
      prefix = ((long long)prefix * 10 + 4) % MOD;
      ret = ((long long)ret +
             (prefix * prefix % MOD * (ten[n - i - 1] * ten[n - i - 1] % MOD)) %
                 MOD * (two[n - i - 1] - 1 + MOD) % MOD +
             prefix * ten[n - i - 1] % MOD *
                 (sum1_len[n - i - 1] + sum2_len[n - i - 1]) % MOD +
             ans_len[n - i - 1]) %
            MOD;
      ret = ((long long)ret +
             ((prefix * ten[n - i - 1] % MOD + all7[n - i - 1]) % MOD *
              (t_prefix * ten[n - i - 1] % MOD + all4[n - i - 1]) % MOD) %
                 MOD) %
            MOD;
      prefix = t_prefix;
    }
  }
  return (int)ret;
}
int main() {
  init();
  while (gets(l)) {
    gets(r);
    int ans = (gao(r) - gao(l) + MOD) % MOD;
    printf("%d\n", ans);
  }
}
