#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
inline int add(int a, int b) {
  if ((a += b) >= mod) a -= mod;
  return a;
}
inline int dec(int a, int b) {
  if ((a -= b) < 0) a += mod;
  return a;
}
inline int mult(int a, int b) {
  long long t = 1ll * a * b;
  if (t >= mod) t %= mod;
  return t;
}
int n;
char A[100010], B[100010];
int summul[100010][2], sum[100010][2], cnt[100010], sum1[100010], pw10[100010];
void init() {
  sum[1][0] = 4;
  sum[1][1] = 7;
  cnt[0] = 1;
  cnt[1] = 2;
  sum1[1] = 1;
  pw10[0] = 1;
  pw10[1] = 10;
  for (int i = 2; i <= n; i++) {
    pw10[i] = mult(pw10[i - 1], 10);
    sum1[i] = add(mult(sum1[i - 1], 10), 1);
    cnt[i] = add(cnt[i - 1], cnt[i - 1]);
    int high = mult(4, pw10[i - 1]);
    summul[i][0] =
        add(add(mult(mult(high, high), cnt[i - 1] - 1),
                add(mult(add(mult(4, pw10[i - 2]), mult(7, sum1[i - 2])),
                         add(mult(7, pw10[i - 2]), mult(4, sum1[i - 2]))),
                    add(summul[i - 1][0], summul[i - 1][1]))),
            mult(high, dec(mult(2, add(sum[i - 1][0], sum[i - 1][1])),
                           mult(11, sum1[i - 1]))));
    high = mult(7, pw10[i - 1]);
    summul[i][1] =
        add(add(mult(mult(high, high), cnt[i - 1] - 1),
                add(mult(add(mult(4, pw10[i - 2]), mult(7, sum1[i - 2])),
                         add(mult(7, pw10[i - 2]), mult(4, sum1[i - 2]))),
                    add(summul[i - 1][0], summul[i - 1][1]))),
            mult(high, dec(mult(2, add(sum[i - 1][0], sum[i - 1][1])),
                           mult(11, sum1[i - 1]))));
    sum[i][0] = add(add(sum[i - 1][0], sum[i - 1][1]),
                    mult(mult(4, cnt[i - 1]), pw10[i - 1]));
    sum[i][1] = add(add(sum[i - 1][0], sum[i - 1][1]),
                    mult(mult(7, cnt[i - 1]), pw10[i - 1]));
  }
}
class dat {
 public:
  int summul, sum, mx, cnt;
};
dat dfs(char* s, int np) {
  if (np == 1) {
    if (s[np] == '4') return (dat){0, 4, 4, 1};
    return (dat){28, 11, 7, 2};
  }
  dat ret = dfs(s, np - 1);
  if (s[np] == '4') {
    if (ret.cnt != 1) {
      int high = mult(4, pw10[np - 1]);
      ret.summul = add(
          ret.summul, add(mult(mult(high, high), dec(ret.cnt, 1)),
                          mult(high, dec(mult(2, ret.sum),
                                         add(mult(4, sum1[np - 1]), ret.mx)))));
    }
    ret.mx = add(ret.mx, mult(4, pw10[np - 1]));
    ret.sum = add(ret.sum, mult(pw10[np - 1], mult(4, ret.cnt)));
  } else {
    if (ret.cnt != 1) {
      int high = mult(7, pw10[np - 1]);
      ret.summul = add(
          ret.summul, add(mult(mult(high, high), dec(ret.cnt, 1)),
                          mult(high, dec(mult(2, ret.sum),
                                         add(mult(4, sum1[np - 1]), ret.mx)))));
    }
    ret.mx = add(ret.mx, mult(7, pw10[np - 1]));
    ret.sum = add(ret.sum, mult(pw10[np - 1], mult(7, ret.cnt)));
    ret.summul = add(ret.summul, summul[np][0]);
    ret.sum = add(ret.sum, sum[np][0]);
    ret.cnt = add(ret.cnt, cnt[np - 1]);
    ret.summul = add(ret.summul,
                     mult(add(mult(4, pw10[np - 1]), mult(7, sum1[np - 1])),
                          add(mult(7, pw10[np - 1]), mult(4, sum1[np - 1]))));
  }
  return ret;
}
int solve(char* s) { return dfs(s, n).summul; }
int main() {
  scanf("%s%s", A + 1, B + 1);
  n = strlen(A + 1);
  init();
  reverse(A + 1, A + n + 1);
  reverse(B + 1, B + n + 1);
  printf("%d\n", (solve(B) - solve(A) + mod) % mod);
  return 0;
}
