#include <bits/stdc++.h>
using namespace std;
long long n, m, i, j, k, L;
long long f[100005], g[100005], u[100005], t[100005], o[100005];
char a[100005], b[100005];
long long Add(long long i, long long A) {
  return (f[i] % 1000000007 + (A * g[i]) % 1000000007 +
          ((o[i] - 1) % 1000000007 * ((A * A) % 1000000007)) % 1000000007) %
         1000000007;
}
void Re() {
  long long i, A1, A2;
  t[0] = 1;
  o[0] = 1;
  u[0] = 0;
  for (i = 1; i <= L; i++) {
    t[i] = (t[i - 1] * 10) % 1000000007;
    o[i] = (o[i - 1] << 1) % 1000000007;
    u[i] = (u[i - 1] * 10 + 1) % 1000000007;
  }
  f[1] = 28;
  g[1] = 11;
  f[0] = g[0] = 0;
  for (i = 2; i <= L; i++) {
    A1 = (4 * t[i - 1]) % 1000000007;
    A2 = (7 * t[i - 1]) % 1000000007;
    f[i] = (Add(i - 1, A1) + Add(i - 1, A2)) % 1000000007;
    f[i] = (f[i] + (A1 + (7 * u[i - 1]) % 1000000007) % 1000000007 *
                       (A2 + (4 * u[i - 1]) % 1000000007) % 1000000007) %
           1000000007;
    g[i] = (2 * g[i - 1]) % 1000000007 +
           ((o[i] - 2) % 1000000007 * (A1 + A2) % 1000000007) % 1000000007;
    g[i] = (g[i] + (A1 + (7 * u[i - 1]) % 1000000007) % 1000000007 +
            (A2 + (4 * u[i - 1]) % 1000000007) % 1000000007) %
           1000000007;
  }
}
long long Getans(char *a) {
  long long i, pre, now, ans;
  pre = 0;
  ans = 0;
  for (i = 0; i < L; i++) {
    pre = ((pre * 10) % 1000000007 + (a[i] - '0')) % 1000000007;
    if (a[i] == '7') {
      now = ((pre - 3) * t[L - i - 1]) % 1000000007;
      ans = (ans + (Add(L - i - 1, now) +
                    ((((now + (7 * u[L - i - 1]) % 1000000007) % 1000000007) *
                      ((now + (3 * t[L - i - 1]) % 1000000007 +
                        (4 * u[L - i - 1]) % 1000000007) %
                       1000000007)) %
                     1000000007)) %
                       1000000007) %
            1000000007;
    }
  }
  return ans % 1000000007;
}
int main() {
  scanf("%s", &a);
  scanf("%s", &b);
  L = strlen(a);
  if (L == 1) {
    printf("28\n");
    return 0;
  }
  Re();
  printf("%I64d\n",
         ((Getans(b) % 1000000007) - (Getans(a) % 1000000007) + 1000000007) %
             1000000007);
  return 0;
}
