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>
template <typename T>
inline void SWAP(T &a, T &b) {
  T tmp = a;
  a = b;
  b = tmp;
}
template <typename T>
inline T ABS(const T &val) {
  return val < 0 ? -val : val;
}
template <typename T>
inline T MAX(const T &a, const T &b) {
  return a > b ? a : b;
}
template <typename T>
inline T MIN(const T &a, const T &b) {
  return a < b ? a : b;
}
template <typename T>
inline T SQR(const T &a) {
  return a * a;
}
const int INTinf = 2147483647;
const int nINTinf = 0 - 2147483648;
using namespace std;
long long v1, v2, p1, p2, rez;
int k;
long long mass[1050];
int cnt = 0;
vector<int> getFirstLuck(long long from) {
  vector<int> vc;
  while (from != 0) {
    int tmp = from % 10;
    from /= 10;
    if (tmp > 7) {
      tmp = 4;
      from++;
    } else if (tmp < 4) {
      tmp = 4;
    } else
      tmp = 7;
    vc.push_back(tmp);
    from /= 10;
  }
  return vc;
}
void getNext(vector<int> &vc) {
  int i = 0;
  while (i != vc.size()) {
    if (vc[i] == 4) {
      vc[i] = 7;
      return;
    }
    vc[i] = 4;
    i++;
  }
  vc.push_back(4);
}
long long getNom(vector<int> &vc) {
  long long rez = 0;
  for (int i = vc.size() - 1; i != -1; i--) {
    rez *= 10;
    rez += vc[i];
  }
  return rez;
}
void gen(long long from, long long to) {
  vector<int> now = getFirstLuck(from);
  long long tmp = getNom(now);
  if (tmp == from) getNext(now);
  while ((tmp = getNom(now)) <= to) {
    mass[cnt++] = tmp;
    getNext(now);
  }
}
inline long long getKol(const int &val1, const int &val2, const int &v1,
                        const int &v2) {
  int last = MIN(v2, val2);
  int f = MAX(val1, v1);
  f--;
  if (last > f) return last - f;
  return 0;
}
int main() {
  cin >> v1 >> v2 >> p1 >> p2 >> k;
  rez = 0;
  gen(MIN(v1, p1) - 1, MAX(v2, p2));
  if (cnt < k) {
    cout << 0 << endl;
    return 0;
  }
  long long allR = (v2 - v1 + 1) * (p2 - p1 + 1);
  long long needR = 0;
  int pos = 0;
  int last = pos + k - 1;
  while (last != cnt) {
    long long r1 = getKol(pos != 0 ? mass[pos - 1] + 1 : -5, mass[pos], v1, v2);
    long long r2;
    if (r1) {
      r2 = getKol(mass[last], last + 1 != cnt ? mass[last + 1] - 1 : 1000000006,
                  p1, p2);
      needR += r1 * r2;
    }
    r1 = getKol(pos != 0 ? mass[pos - 1] + 1 : -5, mass[pos], p1, p2);
    if (r1) {
      r2 = getKol(mass[last], last + 1 != cnt ? mass[last + 1] - 1 : 1000000006,
                  v1, v2);
      needR += r1 * r2;
    }
    if ((k == 1) && (mass[pos] >= v1) && (mass[pos] <= v2) &&
        (mass[pos] >= p1) && (mass[pos] <= p2)) {
      needR--;
    }
    pos++;
    last++;
  }
  cout.setf(ios_base::fixed);
  cout.precision(11);
  double rez = needR;
  rez /= allR;
  cout << rez << endl;
  return 0;
}