#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }
int mul(int a, int b) { return (long long)a * b % MOD; }
int sub(int a, int b) { return a < b ? a - b + MOD : a - b; }
const int MAXN = 100010;
int POW2[MAXN << 1], POW10[MAXN << 1], SUM[MAXN], PRODUCT[MAXN], SEVEN[MAXN];
void init() {
  POW2[0] = POW10[0] = 1;
  for (int i = (1); i < (MAXN << 1); i++) {
    POW2[i] = add(POW2[i - 1], POW2[i - 1]);
    POW10[i] = mul(POW10[i - 1], 10);
  }
  SEVEN[0] = SUM[0] = PRODUCT[0] = 0;
  for (int i = (1); i < (MAXN); i++) {
    SEVEN[i] = add(mul(SEVEN[i - 1], 10), 7);
    SUM[i] = add(mul(SUM[i - 1], 20), mul(POW2[i - 1], 11));
    PRODUCT[i] = add(
        mul(POW10[(i << 1) - 2], add(mul(sub(POW2[i - 1], 1), 65), 4 * 7 * 2)),
        add(mul(SUM[i - 1], mul(POW10[i - 1], 22)),
            add(PRODUCT[i - 1], PRODUCT[i - 1])));
  }
}
int n;
char l[MAXN], r[MAXN];
int calc(int depth, int n, char *number, int X) {
  if (depth == n) return 0;
  int res = calc(depth + 1, n, number, add(mul(X, 10), number[depth] - '0'));
  if (number[depth] == '7') {
    int l = n - depth - 1;
    X = add(mul(X, 10), 4);
    res = add(res, mul(add(mul(mul(X, X), POW2[l]), mul(X, 3)), POW10[l << 1]));
    res =
        add(res, mul(add(mul(add(X, X), SUM[l]), mul(SEVEN[l], 3)), POW10[l]));
    res = add(res, PRODUCT[l]);
  }
  return res;
}
int main() {
  init();
  scanf("%s%s", l, r);
  n = strlen(l);
  printf("%d\n", sub(calc(0, n, r, 0), calc(0, n, l, 0)));
  return 0;
}
