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 JAVA):

Solution:
import java.io.*;
import java.math.*;
import java.util.*;
import static java.lang.Math.*;

public class BetaRound84_Div1_B implements Runnable {
    
    //final String NAME = this.getClass().getSimpleName();

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok;
    
    @Override
    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            if (System.getProperty("ONLINE_JUDGE") == null) {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            tok = new StringTokenizer("");
            solve();
            in.close();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2-t1));
            long m1 = Runtime.getRuntime().freeMemory();
            long m2 = Runtime.getRuntime().totalMemory();
            System.err.println("Memory = " + ((m2-m1)>>10));
        } catch (Throwable e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }
    
    public static void main(String[] args) {
        new Thread(null, new BetaRound84_Div1_B(), "", 256 * (1L<<20)).start();
    }
    
    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }
    
    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }
    
    long readLong() throws IOException {
        return Long.parseLong(readString());
    }
    
    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }
    
    // solution
    
    long[] luckyNumbers() {
        ArrayList<Long> a = new ArrayList<Long>();
        for (int len = 1; len <= 9; len++) {
            for (int m = 0; m < (1 << len); m++) {
                long x = 0;
                for (int i = 0; i < len; i++) {
                    if (((1 << i) & m) == 0) {
                        x = 10 * x + 4;
                    } else {
                        x = 10 * x + 7;
                    }
                }
                a.add(x);
            }
        }
        long[] b = new long[a.size()];
        for (int i = 0; i < a.size(); i++) {
            b[i] = a.get(i);
        }
        Arrays.sort(b);
        return b;
    }
    
    final long[] arr = luckyNumbers();
    
    long prev(long x) {
        if (x == -1) return -111;
        int i = Arrays.binarySearch(arr, x);
        if (i >= 0) {
            return arr[i];
            //if (i == 0) return -1;
            //return arr[i - 1];
        } else {
            i = -i-1;
            if (i == 0) return -111;
            return arr[i - 1];
        }
    }
    
    long next(long x) {
        if (x == -1) return -111;
        int i = Arrays.binarySearch(arr, x);
        if (i >= 0) {
            return arr[i];
            //if (i == arr.length - 1) return -1;
            //return arr[i + 1];
        } else {
            i = -i-1;
            if (i == arr.length) return -111;
            return arr[i];
        }
    }
    
    /*double fr(int L, int R, int k) {
        if (R < L) return 0;
        long len = (R - L + 1);
        int iR = Arrays.binarySearch(arr, R);
        if (iR < 0) {
            iR = (-iR-1) - 1;
        }
        int iL = max(0, iR - k + 1);
        int xL = arr[iL];
        if (xL < L) return 0;
        int x = iL == 0 ? L : arr[xL - 1] + 1;
        return ((double) (xL - x + 1)) / len;
    }
    
    double fl(int L, int R, int k) {
        if (R < L) return 0;
        long len = (R - L + 1);
        int iL = Arrays.binarySearch(arr, L);
        if (iL < 0) {
            iL = (-iL - 1);
        }
        int iR = min(arr.length - 1, iL + k - 1);
        int xR = arr[iR];
        if (xR > R) return 0;
        int x = iR == arr.length - 1 ? R : arr[iR + 1] - 1;
        return ((double) (x - xR + 1)) / len;
    }*/
    
    long len(long a, long b) {
        if (b < a) return 0;
        return b - a + 1;
    }
    
    long count(long L, long R) {
        int i = Arrays.binarySearch(arr, L);
        int j = Arrays.binarySearch(arr, R);
        return max(0, j - i + 1);
    }
    
    long K;
    
    long sum(long a1, long a2, long b1, long b2) {

        long ans = 0;
        for (long L = a1; L <= a2 && L >= -11; L = next(L) + 1) {
            for (long R = b2; R >= b1 && R >= -11; R = prev(R) - 1) {
                long LL = next(L);
                long RR = prev(R);
                
                long LC = len(L, min(a2, LL));
                long RC = len(max(b1, RR), R);
                long c = count(LL, RR);
                if (c == K) {
                    ans += LC * RC;
                }
                //if (c == K && LL == RR) ;
            }
        }
        return ans;
    }
    
    void solve() throws IOException {
        long pl = readLong();
        long pr = readLong();
        long vl = readLong();
        long vr = readLong();
        K = readLong();
        
        long all = len(vl, vr) * len(pl, pr);
        long good = sum(vl, vr, pl, pr) + sum(pl, pr, vl, vr);
        
        if (K == 1) {
            long p = 0;
            HashSet<Long> set = new HashSet<Long>();
            for (long L = max(next(vl), next(pl)); L <= min(prev(vr), prev(pr)) && L >= -11; L = next(L) + 1) {
                set.add(L);
            }
            good -= set.size();
        }
        
        double ans = ((double) good) / all;
        
        out.printf(Locale.US, "%.12f", ans);
        
        /*
        if (pl >= vl) {
            int t = pl; pl = vl; vl = t;
            t = pr; pr = vr; vr = t;
        }
        double ans = 0;
        if (pr < vl) {
            for (int lk = 0; lk <= k; lk++) {
                ans += fr(pl, pr, lk) * fl(vl, vr, k - lk);
            }
        } else {
            for (int lk = 0; lk <= k; lk++) {
                ans += fr(pl, vl - 1, lk) * fl(vl, vr, k - lk);
            }
        }
        */
    }

}