#include <bits/stdc++.h>
using namespace std;
void Get(int &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
char A[1000005];
char B[1000005];
int N;
void Init() {
  scanf("%s%s", A + 1, B + 1);
  N = strlen(A + 1);
}
long long Power10[1000005];
long long SumPower10[1000005];
long long Power2[1000005];
long long Sum[1000005];
long long Mul[1000005];
long long Num[1000005];
long long Num10[1000005];
long long SumNum[1000005];
long long MulNum[1000005];
long long Calc(char *X) {
  memset(Num, 0, sizeof Num);
  memset(Num10, 0, sizeof Num);
  memset(SumNum, 0, sizeof Num);
  memset(MulNum, 0, sizeof Num);
  for (int i = 1; i <= N; i++) {
    (Num[i] = Num[i - 1] + Power2[i - 1] * (X[N - i + 1] == '1')) %=
        (1000000007ll);
    (Num10[i] = Num10[i - 1] + Power10[i - 1] * (X[N - i + 1] == '1')) %=
        (1000000007ll);
  }
  for (int i = 1; i <= N; i++)
    if ((X[N - i + 1] == '0')) {
      SumNum[i] = SumNum[i - 1];
      MulNum[i] = MulNum[i - 1];
    } else {
      (SumNum[i] = Sum[i - 1] + SumNum[i - 1] +
                   Power10[i - 1] * (Num[i - 1] + 1)) %= (1000000007ll);
      (MulNum[i] += SumNum[i - 1] * Power10[i - 1]) %= (1000000007ll);
      (MulNum[i] += SumNum[i - 1] * Power10[i - 1]) %= (1000000007ll);
      (MulNum[i] -= Num10[i - 1] * Power10[i - 1]) %= (1000000007ll);
      (MulNum[i] += (Power10[i - 1] * Power10[i - 1]) % (1000000007ll) *
                    (Num[i - 1])) %= (1000000007ll);
      (MulNum[i] += Mul[i - 1]) %= (1000000007ll);
      (MulNum[i] += MulNum[i - 1]) %= (1000000007ll);
      if (i >= 2)
        (MulNum[i] += (Power10[i - 1] * SumPower10[i - 2])) %= (1000000007ll);
    }
  long long Four = 0;
  for (int i = 1; i <= N; i++) (Four = Four * 10 + 4) %= (1000000007ll);
  long long Ans = ((Four * Four) % (1000000007ll) * Num[N]) % (1000000007ll);
  (Ans += Four * 3 * SumNum[N]) %= (1000000007ll);
  (Ans += Four * 3 * SumNum[N]) %= (1000000007ll);
  (Ans -= Four * 3 * Num10[N]) %= (1000000007ll);
  (Ans += 9 * MulNum[N]) %= (1000000007ll);
  return Ans;
}
long long Ans;
void Work() {
  for (int i = 1; i <= N; i++) {
    if (A[i] == '4')
      A[i] = '0';
    else
      A[i] = '1';
    if (B[i] == '4')
      B[i] = '0';
    else
      B[i] = '1';
  }
  Power10[0] = SumPower10[0] = Power2[0] = 1;
  for (int i = 1; i <= N; i++) {
    (Power10[i] = 10 * Power10[i - 1]) %= (1000000007ll);
    (Power2[i] = 2 * Power2[i - 1]) %= (1000000007ll);
    (SumPower10[i] = Power10[i] + SumPower10[i - 1]) %= (1000000007ll);
  }
  for (int i = 1; i <= N; i++)
    (Sum[i] = Sum[i - 1] * 2 + Power10[i - 1] * Power2[i - 1]) %=
        (1000000007ll);
  for (int i = 1; i <= N; i++) {
    (Mul[i] += Sum[i - 1] * Power10[i - 1]) %= (1000000007ll);
    (Mul[i] += Sum[i - 1] * Power10[i - 1]) %= (1000000007ll);
    if (i >= 2)
      (Mul[i] -= (SumPower10[i - 2]) * Power10[i - 1]) %= (1000000007ll);
    (Mul[i] += (Power10[i - 1] * Power10[i - 1]) % (1000000007ll) *
               (Power2[i - 1] - 1)) %= (1000000007ll);
    (Mul[i] += Mul[i - 1]) %= (1000000007ll);
    (Mul[i] += Mul[i - 1]) %= (1000000007ll);
    if (i >= 2)
      (Mul[i] += (Power10[i - 1] * SumPower10[i - 2])) %= (1000000007ll);
  }
  Ans = Calc(B);
  Ans -= Calc(A);
  Ans %= (1000000007ll);
  if (Ans < 0) Ans += (1000000007ll);
}
void Output() { printf("%I64d\n", Ans); }
int main() {
  Init();
  Work();
  Output();
  return 0;
}
