#include <bits/stdc++.h>
const int maxn = 100010;
const int mod = 1000000007;
char s[maxn], t[maxn];
void Add(long long &a, long long b) {
  a += b;
  a = (a % mod + mod) % mod;
}
long long gao(char s[]) {
  int n = strlen(s);
  long long dp[2] = {0}, sum2[2] = {0}, sum[2] = {0}, tot = 1, A_tot = 0,
            A_1 = 0;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    cur ^= 1;
    dp[cur] = dp[cur ^ 1] * 100 + sum2[cur ^ 1] * 100 + 220 * sum[cur ^ 1] +
              56 * (tot - 1) + 70 * (A_tot - A_1);
    dp[cur] %= mod;
    sum[cur] = sum[cur ^ 1] * 20 + 11 * (tot - 1);
    sum[cur] %= mod;
    sum2[cur] = 200 * sum2[cur ^ 1] + 65 * (tot - 1) + 220 * sum[cur ^ 1];
    sum2[cur] %= mod;
    tot = tot * 2 % mod;
    A_1 = A_1 * 10 + 4;
    A_1 %= mod;
    A_tot = A_tot * 10 + s[i] - '0';
    A_tot %= mod;
    if (s[i] == '7') {
      Add(dp[cur], (A_tot - 3) * A_tot);
      Add(sum[cur], A_tot - 3);
      Add(sum2[cur], (A_tot - 3) * (A_tot - 3));
    } else {
      tot = ((tot - 1) % mod + mod) % mod;
    }
  }
  return dp[cur];
}
int main() {
  scanf("%s%s", s, t);
  printf("%I64d\n", ((gao(t) - gao(s)) % mod + mod) % mod);
  return 0;
}
