#include <bits/stdc++.h>
using namespace std;
char ll[101000], rr[101000];
const int mod = 1000000007;
inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += mod;
  return a;
}
inline int mul(int a, int b) { return (a * (long long)b) % mod; }
int a[101000], b[101000], c[101000], d[101000];
int p2[101000], p10[101000];
int n;
inline int solve(char* in) {
  int A = mul(c[n], 4);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (in[i] == '7') {
      int k = n - 1 - i;
      ans = add(ans, mul(mul(A, A), p2[k]));
      ans = add(ans, mul(A, add(mul(3, p10[k]), mul(2, a[k]))));
      ans = add(ans, b[k]);
      ans = add(ans, mul(mul(c[k], 3), mul(p10[k], 3)));
      A = add(A, mul(p10[k], 3));
    }
  }
  return ans;
}
int main() {
  scanf("%s", ll);
  scanf("%s", rr);
  n = strlen(ll);
  p2[0] = 1;
  for (int i = 1; i <= n; i++) p2[i] = mul(p2[i - 1], 2);
  p10[0] = 1;
  for (int i = 1; i <= n; i++) p10[i] = mul(p10[i - 1], 10);
  a[0] = 0;
  for (int i = 1; i <= n; i++)
    a[i] = add(mul(a[i - 1], 2), mul(3, mul(p10[i - 1], p2[i - 1])));
  c[0] = 0;
  for (int i = 1; i <= n; i++) c[i] = add(mul(c[i - 1], 10), 1);
  b[0] = 0;
  for (int i = 0; i < n; i++) {
    b[i + 1] = mul(2, b[i]);
    b[i + 1] = add(b[i + 1], mul(mul(3, p10[i]), mul(3, c[i])));
    b[i + 1] =
        add(b[i + 1], mul(mul(mul(3, p10[i]), mul(3, p10[i])), sub(p2[i], 1)));
    b[i + 1] =
        add(b[i + 1], mul(mul(3, p10[i]), sub(mul(2, a[i]), mul(3, c[i]))));
  }
  printf("%d\n", sub(solve(rr), solve(ll)));
}
