#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
char str[100010];
int num[100010];
long long two[100010], ten[100010], all4[100010], all7[100010];
long long sum_no_all4[100010], sum_no_all7[100010], ans_of_len[100010],
    sum_of_all[100010];
void pre() {
  int i;
  two[0] = 1;
  ten[0] = 1;
  sum_no_all4[1] = 7;
  sum_no_all7[1] = 4;
  sum_of_all[1] = 11;
  all4[0] = 0;
  all7[0] = 0;
  for (i = 1; i <= 100000; i++) {
    two[i] = (two[i - 1] * 2LL) % mod;
    ten[i] = (ten[i - 1] * 10LL) % mod;
    all4[i] = (all4[i - 1] * 10LL + 4LL) % mod;
    all7[i] = (all7[i - 1] * 10LL + 7LL) % mod;
  }
  for (i = 2; i <= 100000; i++) {
    sum_of_all[i] = (((11LL * ten[i - 1]) % mod) * two[i - 1]) % mod;
    sum_of_all[i] = (sum_of_all[i] + (sum_of_all[i - 1] * two[1]) % mod) % mod;
    sum_no_all4[i] = ((sum_of_all[i] - all4[i]) % mod + mod) % mod;
    sum_no_all7[i] = ((sum_of_all[i] - all7[i]) % mod + mod) % mod;
  }
  ans_of_len[1] = 28LL;
  for (i = 2; i <= 100000; i++) {
    ans_of_len[i] = (((7LL * ten[i - 1] + all4[i - 1]) % mod) *
                     (4LL * ten[i - 1] + all7[i - 1]) % mod) %
                    mod;
    ans_of_len[i] =
        (ans_of_len[i] +
         (((((((7LL * 7LL + 4LL * 4LL) * ten[i - 1]) % mod) * ten[i - 1]) %
            mod) %
           mod) *
          ((two[i - 1] - 1 + mod) % mod)) %
             mod +
         (ans_of_len[i - 1] * 2) % mod +
         ((11LL *
           ((ten[i - 1] * ((sum_no_all4[i - 1] + sum_no_all7[i - 1]) % mod)) %
            mod)) %
          mod)) %
        mod;
  }
}
long long solve(int n) {
  int i;
  long long res = 0LL, now = 0LL, temp = 0LL;
  for (i = 0; i < n; i++) {
    if (num[i] == 4)
      now = (now * 10LL + 4LL) % mod;
    else {
      temp = (now * 10LL + 7LL) % mod;
      now = (now * 10LL + 4LL) % mod;
      res = (res + ((((((((now * now) % mod) * ten[n - i - 1]) % mod) *
                       ten[n - i - 1]) %
                      mod) *
                     ((two[n - i - 1] - 1 + mod) % mod)) %
                    mod)) %
            mod;
      res = (res + (((now * ten[n - i - 1]) % mod) *
                    ((sum_no_all4[n - i - 1] + sum_no_all7[n - i - 1]) % mod)) %
                       mod) %
            mod;
      res = (res + ans_of_len[n - i - 1]) % mod;
      res = (res + ((((temp * ten[n - i - 1]) % mod + all4[n - i - 1]) % mod) *
                    (((now * ten[n - i - 1]) % mod + all7[n - i - 1]) % mod)) %
                       mod) %
            mod;
      now = temp;
    }
  }
  return res;
}
int main() {
  int i, l;
  pre();
  long long ans = 0;
  scanf("%s", str);
  l = strlen(str);
  for (i = 0; i < l; i++) num[i] = str[i] - '0';
  ans = -solve(l);
  scanf("%s", str);
  l = strlen(str);
  for (i = 0; i < l; i++) num[i] = str[i] - '0';
  ans = ((ans + solve(l)) + mod) % mod;
  printf("%I64d\n", ans);
  return 0;
}
