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>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-8;
const long double PI = 3.1415926535897932384626433832795;
vector<long long> a;
long long l1, r1, l2, r2;
int k;
vector<pair<long long, long long> > getV(long long l, long long r) {
  a.clear();
  for (int len = 1; len <= 9; len++)
    for (int mask = 0; mask < (int)(1 << len); mask++) {
      long long cur = 0;
      for (int i = 0; i < (int)(len); i++)
        if ((mask & (1 << i)) != 0)
          cur = cur * 10 + 4;
        else
          cur = cur * 10 + 7;
      a.push_back(cur);
    }
  sort(a.begin(), a.end());
  long long cur = 0;
  vector<pair<long long, long long> > t;
  for (int i = 0; i < (int)(a.size()); i++) {
    t.push_back(make_pair(cur, a[i] - 1));
    t.push_back(make_pair(a[i], a[i]));
    cur = a[i] + 1;
  }
  t.push_back(make_pair(cur, INF64));
  vector<pair<long long, long long> > ans;
  for (int i = 0; i < (int)(t.size()); i++) {
    t[i].first = max(l, t[i].first);
    t[i].second = min(t[i].second, r);
    if (t[i].first <= t[i].second) ans.push_back(t[i]);
  }
  return ans;
}
int get(long long l, long long r) {
  if (l > r) swap(l, r);
  return (int)(upper_bound(a.begin(), a.end(), r) -
               lower_bound(a.begin(), a.end(), l));
}
int main() {
  cin >> l1 >> r1;
  cin >> l2 >> r2;
  cin >> k;
  vector<pair<long long, long long> > a1 = getV(l1, r1);
  vector<pair<long long, long long> > a2 = getV(l2, r2);
  long long c = 0, z = (r1 - l1 + 1) * (r2 - l2 + 1);
  for (int i = 0; i < (int)(a1.size()); i++)
    for (int j = 0; j < (int)(a2.size()); j++)
      if (get(a1[i].first, a2[j].first) == k)
        c +=
            (a1[i].second - a1[i].first + 1) * (a2[j].second - a2[j].first + 1);
  cout.precision(15);
  cout << fixed << (0.0 + c) / (0.0 + z) << endl;
  return 0;
}