#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,-funroll-loops")
using namespace std;
constexpr int mod = 1e9 + 7;
inline int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
inline int mul(int x, int y) { return 1LL * x * y - 1LL * x * y / mod * mod; }
inline void inc(int &x, int y) { (x += y) >= mod && (x -= mod); }
constexpr int Maxn = 2e5 + 5;
int pw[Maxn], pw4[Maxn], pw7[Maxn];
void init_power(int N) {
  pw[0] = 1;
  pw4[0] = 0;
  pw7[0] = 0;
  for (int i = 1; i <= N; ++i) {
    pw[i] = mul(pw[i - 1], 10);
    pw4[i] = add(mul(pw4[i - 1], 10), 4);
    pw7[i] = add(mul(pw7[i - 1], 10), 7);
  }
}
struct data_t {
  int sqr, sum, cnt;
  data_t() = default;
  data_t(int sqr, int sum, int cnt) : sqr(sqr), sum(sum), cnt(cnt) {}
  ~data_t() = default;
  data_t &operator+=(const data_t &y) {
    inc(sqr, y.sqr);
    inc(sum, y.sum);
    inc(cnt, y.cnt);
    return *this;
  }
  friend data_t operator*(const data_t &x, int dig) {
    assert(0 <= dig && dig < 10);
    int new_sqr =
        add(add(mul(x.sqr, 100), mul(x.sum, dig * 20)), mul(x.cnt, dig * dig));
    int new_sum = add(mul(x.sum, 10), mul(x.cnt, dig));
    int new_cnt = x.cnt;
    return data_t(new_sqr, new_sum, new_cnt);
  }
};
data_t rec[Maxn][2];
inline int get_num_4(int c) { return add(mul(4, pw[c]), pw7[c]); }
inline int get_num_7(int c) { return add(mul(7, pw[c]), pw4[c]); }
int get(const data_t &A, int c) {
  int zero_exp = mul(mul(get_num_4(c), get_num_7(c)), A.cnt);
  int one_exp = mul(mul(add(get_num_4(c), get_num_7(c)), pw[c + 1]), A.sum);
  int two_exp = mul(pw[c * 2 + 2], A.sqr);
  return add(zero_exp, add(one_exp, two_exp));
}
int calc(char *num) {
  int n = strlen(num);
  memset(rec, 0, sizeof(data_t) * (n + 1) * 2);
  rec[0][1].cnt = 1;
  for (int i = 0; i < n; ++i) {
    if (num[i] == '4') {
      rec[i + 1][0] += rec[i][0] * 4;
      rec[i + 1][0] += rec[i][0] * 7;
      rec[i + 1][1] += rec[i][1] * 4;
    } else {
      rec[i + 1][0] += rec[i][0] * 4;
      rec[i + 1][0] += rec[i][0] * 7;
      rec[i + 1][0] += rec[i][1] * 4;
      rec[i + 1][1] += rec[i][1] * 7;
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if (num[i] == '4') {
      inc(ans, get(rec[i][0], n - i - 1));
    } else {
      inc(ans, get(rec[i][0], n - i - 1));
      inc(ans, get(rec[i][1], n - i - 1));
    }
  }
  return ans;
}
int main() {
  init_power(Maxn - 1);
  static char num[Maxn] = {};
  scanf("%s", num);
  int ans = mod - calc(num);
  scanf("%s", num);
  inc(ans, calc(num));
  printf("%d\n", ans);
  return 0;
}
