#include <bits/stdc++.h>
using namespace std;
long long b[110000], b4[110000], b7[110000], s[110000], f[110000], sum[110000],
    n, m, a[110000], len, ans = 0;
char s1[110000], s2[110000];
long long mo(long long a) {
  if (a >= 0 && a < 1000000007) return a;
  a %= 1000000007;
  if (a < 0) a += 1000000007;
  return a;
}
long long sqr(long long x) { return mo(mo(x) * mo(x)); }
long long cal() {
  long long last = 0, ans = 0, A = 0;
  for (int i = 1; i < len; i++) {
    ans = mo(ans + f[i]);
    ans = mo(ans + b4[i] * last);
    last = b7[i];
  }
  for (int i = len; i; i--)
    if (a[i] == 7) {
      A = mo(A + 4 * b[i]);
      ans = mo(ans + mo(sqr(A) * (sum[i - 1] - 1)) +
               mo(A * mo(s[i - 1] * 2 - b4[i - 1] - b7[i - 1])) + f[i - 1]);
      ans = mo(ans + mo(A + b4[i - 1]) * last);
      last = mo(A + b7[i - 1]);
      A = mo(A + 3 * b[i]);
    } else
      A = mo(A + 4 * b[i]);
  ans = mo(A * last + ans);
  return ans;
}
int main() {
  scanf("%s", s1);
  n = strlen(s1);
  for (int i = n; i; i--) s1[i] = s1[i - 1];
  scanf("%s", s2);
  m = strlen(s2);
  for (int i = m; i; i--) s2[i] = s2[i - 1];
  sum[0] = 1;
  sum[1] = 2;
  s[1] = 11;
  f[1] = 28;
  b[1] = 1;
  b4[1] = 4;
  b7[1] = 7;
  for (int i = 2; i <= m; i++)
    b[i] = mo(b[i - 1] * 10), b4[i] = mo(b4[i - 1] * 10 + 4),
    b7[i] = mo(b7[i - 1] * 10 + 7);
  for (int i = 2; i <= m; i++) {
    sum[i] = mo(sum[i - 1] * 2);
    s[i] = mo(mo((long long)11 * mo(b[i] * sum[i - 1])) + s[i - 1] * 2);
    f[i] = mo(mo(sqr(b[i] * 4) + sqr(b[i] * 7)) * mo(sum[i - 1] - 1));
    f[i] = mo(f[i] + mo(mo((long long)11 * b[i]) *
                        mo(s[i - 1] * 2 - b4[i - 1] - b7[i - 1])));
    f[i] = mo(f[i] + mo(f[i - 1] * 2));
    f[i] = mo(f[i] + mo(mo((long long)4 * b[i] + b7[i - 1]) *
                        mo((long long)7 * b[i] + b4[i - 1])));
  }
  len = m;
  for (int i = 1; i <= len; i++) a[i] = s2[len - i + 1] - '0';
  ans = cal();
  len = n;
  for (int i = 1; i <= len; i++) a[i] = s1[len - i + 1] - '0';
  ans = mo(ans - cal());
  cout << ans << endl;
  return 0;
}
