#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int INF = 1e9 + 7;
int n;
long long full4[maxn], full7[maxn], f[maxn], g[maxn], pw10[maxn], pw2[maxn];
char s[maxn], t[maxn];
inline long long add(const long long &x, const long long &y) {
  return (x + y) % INF;
}
inline long long sub(const long long &x, const long long &y) {
  return (x - y + INF) % INF;
}
inline long long mul(const long long &x, const long long &y) {
  return (x * y) % INF;
}
inline void uadd(long long &x, const long long y) { (x += y) %= INF; }
inline void precalc() {
  pw10[0] = pw2[0] = 1;
  for (int i = (1); i <= (n); ++i) {
    full4[i] = add(mul(full4[i - 1], 10), 4);
    full7[i] = add(mul(full7[i - 1], 10), 7);
    pw10[i] = mul(pw10[i - 1], 10);
    pw2[i] = mul(pw2[i - 1], 2);
    f[i] = add(mul(f[i - 1], 2), mul((4 + 7), mul(pw10[i - 1], pw2[i - 1])));
    uadd(g[i], add(mul(g[i - 1], 2), mul(full7[i - 1], full4[i - 1])));
    uadd(g[i], mul(pw10[i - 1],
                   add(mul(4, f[i - 1]), mul(7, sub(f[i - 1], full4[i - 1])))));
    uadd(g[i], mul(pw10[i - 1],
                   add(mul(7, f[i - 1]), mul(4, sub(f[i - 1], full7[i - 1])))));
    uadd(g[i], mul(mul(pw10[i - 1], pw10[i - 1]),
                   add(mul(sub(pw2[i - 1], 1), (16 + 49)), 28)));
  }
  return;
}
inline int solve(char *str) {
  long long ret = 0, pre = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (str[i] == '7') {
      uadd(ret, g[i]);
      uadd(ret,
           mul(mul(mul(add(mul(pre, 10), 4), pw10[i]), add(mul(pre, 10), 4)),
               mul(pw10[i], sub(pw2[i], 1))));
      uadd(ret, mul(mul(add(mul(pre, 10), 4), pw10[i]),
                    add(sub(f[i], full4[i]), sub(f[i], full7[i]))));
      uadd(ret, mul(add(mul(add(mul(pre, 10), 4), pw10[i]), full7[i]),
                    add(mul(add(mul(pre, 10), 7), pw10[i]), full4[i])));
    }
    pre = add(mul(pre, 10), str[i] - '0');
  }
  return ret;
}
int main() {
  scanf("%s%s", s, t);
  n = strlen(s);
  reverse(s, s + n);
  reverse(t, t + n);
  precalc();
  printf("%d\n", sub(solve(t), solve(s)));
}
