#include <bits/stdc++.h>
const long long bigp = 1000000007;
long long len, f[200001], f10[200001], f47[200001], f74[200001], f2n[200001],
    fsum[200001];
char a[200001], b[200001];
void dp() {
  long long i, t47 = 4, t74 = 7, t10 = 1, t11 = 0, t2n = 1, sum = 0;
  f[1] = 28, f10[1] = 1, f47[1] = 4, f74[1] = 7;
  for (i = 2; i <= len; ++i) {
    sum = (sum * 2 + t10 * t2n % bigp * 11) % bigp;
    t47 = (t47 * 10 + 7) % bigp;
    t74 = (t74 * 10 + 4) % bigp;
    t10 = t10 * 10 % bigp;
    t11 = (t11 * 10 + 1) % bigp;
    t2n = t2n * 2 % bigp;
    f[i] = (t10 * t10 % bigp * 65 % bigp * (t2n - 1) +
            t10 * 11 % bigp * (sum * 2 - t11 * 11 % bigp) + 2 * f[i - 1] +
            t47 * t74) %
           bigp;
    f10[i] = t10;
    f47[i] = t47;
    f74[i] = t74;
    f2n[i] = t2n - 1;
    fsum[i] = (sum * 2 - t11 * 11) % bigp;
  }
}
long long solve(char a[]) {
  long long i, now = 0, ans = 0;
  for (i = 0; i < len; ++i) {
    if (a[i] == '7') {
      long long now2 = (now * 10 + 4) % bigp * f10[len - i] % bigp;
      ans = (ans + now2 * now2 % bigp * f2n[len - i] + now2 * fsum[len - i] +
             f[len - i - 1]) %
            bigp;
      now2 = now * f10[len - i + 1] % bigp;
      ans = (ans + now2 * now2 + now2 * (f47[len - i] + f74[len - i]) +
             f47[len - i] * f74[len - i]) %
            bigp;
    }
    now = (now * 10 + a[i] - '0') % bigp;
  }
  return ans;
}
int main() {
  scanf("%s%s", a, b);
  len = strlen(a);
  dp();
  long long ans = (solve(b) - solve(a)) % bigp;
  if (ans < 0) ans += bigp;
  printf("%I64d\n", ans);
  return 0;
}
