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.sql.SQLSyntaxErrorException;
import java.util.*;
import java.util.zip.Adler32;

public class Contest1 {
    static ArrayList<Integer>arr;
    static void bf(long x){
        if (x>1e9){
            return;
        }
        arr.add((int) x);
        bf(x*10+4);
        bf(x*10+7);
    }
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        arr= new ArrayList<>();
        bf(4);
        bf(7);
        Collections.sort(arr);
//        pw.println(arr);

        int l1= sc.nextInt();
        int r1= sc.nextInt();
        int l2=sc.nextInt();
        int r2=sc.nextInt();
        int k = sc.nextInt();
        int i =0;int j =k-1;
        if (k>arr.size()) {
            pw.println(0);
            pw.flush();
            return;
        }
        double ans=0;
        double tot=0;
        double size1=r1-l1+1;
        double size2=r2-l2+1;
        while (j< arr.size()){
            int[] c1= new int[2],c2=new int[2];
            if (i==0){
                c1[0]=getinrange(l1,r1,1,arr.get(i));
                c2[0]=getinrange(l2,r2,1,arr.get(i));
            }
            else {
                c1[0]=getinrange(l1,r1,arr.get(i-1)+1,arr.get(i));
                c2[0]=getinrange(l2,r2,arr.get(i-1)+1,arr.get(i));
            }
            if (j==arr.size()-1){
                c1[1]=getinrange(l1,r1,arr.get(j),(int)1e9+100);
                c2[1]=getinrange(l2,r2,arr.get(j),(int)1e9+100);
            }
            else {
                c1[1]=getinrange(l1,r1,arr.get(j),arr.get(j+1)-1);
                c2[1]=getinrange(l2,r2,arr.get(j),arr.get(j+1)-1);
            }
            ans += (1.0 * c1[0]) * (c2[1]) / (size1 * size2);
            if (k!=1)
            ans += (1.0 * c1[1]) * (c2[0]) / (size1 * size2);
            else ans += Math.max((1.0 * c1[1]) * (c2[0]) -1,0) / (size1 * size2);

//            if (ans>=size1*size2) {
//                tot+=ans/(size1*size2);
//                ans=0;
//            }
            i++;j++;
        }
        pw.println(ans);
        pw.flush();
    }
    static int getinrange(int l,int r,int s,int e){
        if (s>r||e<l)
            return 0;
        int f = Math.max(s,l);
        int ls= Math.min(e,r);
        return ls-f+1;
    }
    public static void Shuffle(int[]a){
        for (int i =0;i<a.length;i++){
            int t = a[i];
            int id = (int)(Math.random()*a.length);
            a[i]=a[id];
            a[id]=t;
        }
    }
    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}