#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
char s[100005];
int n;
struct data {
  long long sqr, cnt, sum;
  data(long long _sqr = 0, long long _sum = 0, long long _cnt = 0) {
    sqr = _sqr;
    sum = _sum;
    cnt = _cnt;
  }
} dp[100005][2];
long long pw[200005], seven[100005], four[100005];
inline data upd4(data p) {
  return data((p.sqr * 100ll + p.sum * 80ll + p.cnt * 16ll) % MOD,
              (p.sum * 10ll + p.cnt * 4ll) % MOD, (p.cnt));
}
inline data upd7(data p) {
  return data((p.sqr * 100ll + p.sum * 140ll + p.cnt * 49ll) % MOD,
              (p.sum * 10ll + p.cnt * 7ll) % MOD, (p.cnt));
}
inline void add(data &x, data y) {
  x.sqr += y.sqr;
  if (x.sqr >= MOD) x.sqr -= MOD;
  x.sum += y.sum;
  if (x.sum >= MOD) x.sum -= MOD;
  x.cnt += y.cnt;
  if (x.cnt >= MOD) x.cnt -= MOD;
}
inline long long get(data x, long long k);
inline long long calc() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 0; i <= n; i++) dp[i][0] = dp[i][1] = data(0, 0, 0);
  dp[0][1] = data(0, 0, 1);
  for (int i = 1; i <= n; i++) {
    dp[i][0] = dp[i][1] = data(0, 0, 0);
    if (s[i] == '4') {
      add(dp[i][0], upd4(dp[i - 1][0]));
      add(dp[i][0], upd7(dp[i - 1][0]));
      add(dp[i][1], upd4(dp[i - 1][1]));
    } else {
      add(dp[i][0], upd4(dp[i - 1][0]));
      add(dp[i][0], upd4(dp[i - 1][1]));
      add(dp[i][0], upd7(dp[i - 1][0]));
      add(dp[i][1], upd7(dp[i - 1][1]));
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i + 1] == '4') {
      ans = (ans + get(dp[i][0], n - i - 1)) % MOD;
    } else {
      ans = (ans + get(dp[i][0], n - i - 1)) % MOD;
      ans = (ans + get(dp[i][1], n - i - 1)) % MOD;
    }
  }
  return ans;
}
int main() {
  pw[0] = 1;
  for (int i = 1; i <= 200002; i++) pw[i] = pw[i - 1] * 10 % MOD;
  for (int i = 1; i <= 100000; i++) seven[i] = (seven[i - 1] * 10 + 7) % MOD;
  for (int i = 1; i <= 100000; i++) four[i] = (four[i - 1] * 10 + 4) % MOD;
  long long L = calc(), R = calc();
  printf("%lld\n", (R - L + MOD) % MOD);
  return 0;
}
inline long long get(data x, long long k) {
  return (seven[k] * four[k] % MOD * x.cnt % MOD +
          seven[k] * pw[k + 1] % MOD * x.sum % MOD +
          seven[k] * 7 % MOD * pw[k] % MOD * x.cnt % MOD +
          four[k] * pw[k + 1] % MOD * x.sum % MOD +
          four[k] * 4 % MOD * pw[k] % MOD * x.cnt % MOD +
          pw[(k << 1) + 2] * x.sqr % MOD +
          110 * pw[k << 1] % MOD * x.sum % MOD +
          28 * pw[k << 1] % MOD * x.cnt % MOD) %
         MOD;
}
