Problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Petya and his friend Vasya play an interesting game. Petya randomly chooses an integer p from the interval [pl, pr] and Vasya chooses an integer v from the interval [vl, vr] (also randomly). Both players choose their integers equiprobably. Find the probability that the interval [min(v, p), max(v, p)] contains exactly k lucky numbers.

Input

The single line contains five integers pl, pr, vl, vr and k (1 ≤ pl ≤ pr ≤ 109, 1 ≤ vl ≤ vr ≤ 109, 1 ≤ k ≤ 1000).

Output

On the single line print the result with an absolute error of no more than 10 - 9.

Examples

Input

1 10 1 10 2


Output

0.320000000000


Input

5 6 8 10 1


Output

1.000000000000

Note

Consider that [a, b] denotes an interval of integers; this interval includes the boundaries. That is, <image>

In first case there are 32 suitable pairs: (1, 7), (1, 8), (1, 9), (1, 10), (2, 7), (2, 8), (2, 9), (2, 10), (3, 7), (3, 8), (3, 9), (3, 10), (4, 7), (4, 8), (4, 9), (4, 10), (7, 1), (7, 2), (7, 3), (7, 4), (8, 1), (8, 2), (8, 3), (8, 4), (9, 1), (9, 2), (9, 3), (9, 4), (10, 1), (10, 2), (10, 3), (10, 4). Total number of possible pairs is 10·10 = 100, so answer is 32 / 100.

In second case Petya always get number less than Vasya and the only lucky 7 is between this numbers, so there will be always 1 lucky number.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename TT>
ostream& operator<<(ostream& s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, vector<T> t) {
  for (int i = 0; i < t.size(); i++) s << t[i] << " ";
  return s;
}
vector<int> s;
void dfs(int first) {
  if (first >= 1000000007) return;
  s.push_back(first);
  if (first * 10LL + 4 < 1000000007) dfs(first * 10 + 4);
  if (first * 10LL + 7 < 1000000007) dfs(first * 10 + 7);
}
double g[1025], f[1025];
int K;
double solve(int a, int b, int c, int d, double n, double m) {
  if (a > b || c > d) return 0;
  int first = lower_bound(s.begin(), s.end(), b + 1) - s.begin();
  int second = lower_bound(s.begin(), s.end(), c) - s.begin() - 1;
  int len = second - first + 1;
  if (len > K) return 0;
  int k = K - len;
  for (int i = 0; i <= k; i++) g[i] = f[i] = 0;
  int pos = c, i;
  double ans = 0;
  first--, second++;
  for (i = 0; second < s.size(); second++, i++) {
    if (pos > d || i > k) break;
    g[i] = (min(s[second], d + 1) - pos + 0.) / m;
    pos = s[second];
  }
  pos = b;
  for (i = 0; first >= 0; first--, i++) {
    if (pos < a || i > k) break;
    f[i] = (pos + 0. - max(s[first], a - 1)) / n;
    pos = s[first];
  }
  for (i = 0; i <= k; i++) {
    ans += g[i] * f[k - i];
  }
  return ans;
}
double solve1(int a, int b, double n, double m) {
  if (b < a) return 0;
  int first = lower_bound(s.begin(), s.end(), a) - s.begin();
  n *= m;
  double ans = 0;
  int num = 0;
  for (; first + K < s.size(); first++) {
    int second = first + K - 1;
    if (s[second] > b) break;
    num++;
    ans += (s[first] - max(a, s[first - 1] + 1) + 1.) *
           (min(s[second + 1] - 1, b) - s[second] + 1.) / n;
  }
  ans *= 2;
  if (K == 1) ans -= num * 1. / n;
  return ans;
}
int main() {
  int i, j, T;
  s.clear();
  dfs(0);
  s.push_back(1000000000);
  sort(s.begin(), s.end());
  int a, b, c, d;
  while (~scanf("%d%d%d%d%d", &a, &b, &c, &d, &K)) {
    if (a > c) {
      swap(a, c);
      swap(b, d);
    }
    double n = b - a + 1, m = d - c + 1, ans = 0;
    if (b < c)
      ans = solve(a, b, c, d, n, m);
    else {
      if (d < b)
        ans = solve(a, c - 1, c, d, n, m) + solve(c, d, d + 1, b, m, n) +
              solve1(c, d, n, m);
      else
        ans = solve(a, c - 1, b + 1, d, n, m) + solve(a, c - 1, c, b, n, m) +
              solve(c, b, b + 1, d, n, m) + solve1(c, b, n, m);
    }
    printf("%.9lf\n", ans);
  }
}