#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void smin(T &a, const U &b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, const U &b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T1, class T2>
inline void gn(T1 &x1, T2 &x2) {
  gn(x1), gn(x2);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
const int mod = 1000000007;
int pt[100100], p2[100100];
int sum[100100], dp[100100], mn[100100], mx[100100];
char s[100100], t[100100];
int calc(char *s, int n) {
  int ans = 0, val = 0, pre = 0;
  for (int i = 0; i < n; i++) {
    int v = (val + 4LL * pt[n - i - 1]) % mod;
    if (s[i] == '7') {
      ans = (ans + (long long)v * v % mod * (p2[n - i - 1] - 1) +
             (long long)v *
                 (2LL * sum[n - i - 1] - mn[n - i - 1] - mx[n - i - 1]) +
             dp[n - i - 1]) %
            mod;
      ans = (ans + mod) % mod;
      if (pre)
        ans = (ans + (long long)(pre + mx[n - i]) * (v + mn[n - i - 1])) % mod;
    }
    if (s[i] == '7')
      pre = (val + 4LL * pt[n - i - 1]) % mod;
    else if (pre)
      pre = (pre + 7LL * pt[n - i - 1]) % mod;
    val = (val + (long long)(s[i] - '0') * pt[n - i - 1]) % mod;
  }
  ans = (ans + (long long)val * pre) % mod;
  return ans;
}
int main() {
  scanf("%s %s", s, t);
  int n = strlen(s);
  for (int i = pt[0] = p2[0] = 1; i <= n; i++)
    pt[i] = 10LL * pt[i - 1] % mod, p2[i] = p2[i - 1] * 2 % mod;
  for (int i = 1; i <= n; i++) {
    dp[i] =
        ((long long)pt[i - 1] * pt[i - 1] % mod * (4 * 4 + 7 * 7) % mod *
             (p2[i - 1] - 1) +
         11LL * pt[i - 1] % mod * (2LL * sum[i - 1] - mn[i - 1] - mx[i - 1]) +
         2LL * dp[i - 1] +
         (4LL * pt[i - 1] + mx[i - 1]) % mod *
             (7LL * pt[i - 1] % mod + mn[i - 1])) %
        mod;
    dp[i] = (dp[i] + mod) % mod;
    mn[i] = (10LL * mn[i - 1] + 4) % mod;
    mx[i] = (10LL * mx[i - 1] + 7) % mod;
    sum[i] = (2LL * sum[i - 1] + 11LL * pt[i - 1] % mod * p2[i - 1]) % mod;
  }
  cout << (calc(t, n) - calc(s, n) + mod) % mod << endl;
  return 0;
}
