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.util.*;
import java.math.*;
import static java.lang.Character.isDigit;
import static java.lang.Character.isLowerCase;
import static java.lang.Character.isUpperCase;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Character.isDigit;

public class Main{
    static void debug(Object...os){
        System.err.println(deepToString(os));
    }
    
    void run(){
        int pl=nextInt(),pr=nextInt(),vl=nextInt(),vr=nextInt(),k=nextInt();
        TreeSet<Integer> set=new TreeSet<Integer>();
        for(int i=1;i<10;i++) {
            for(int j=0;j<1<<i;j++) {
                int val=0;
                for(int l=0;l<i;l++) {
                    val*=10;
                    val+=((j>>l&1)==0) ? 4:7;
                }
                set.add(val);
            }
        }
        ls=tois(set.toArray(new Integer[0]));
        E[] es1=make(pl,pr);
        E[] es2=make(vl,vr);
        long num=0;
        long den=(long)(pr-pl+1) * (vr-vl+1);
        for(int i=0;i<es1.length;i++)for(int j=0;j<es2.length;j++) {
            int a=min(i,j),b=max(i,j);
            if(k== (b-a+1 + ((a&1)==1 ? 1 : 0))/2) {
                num += (long)es1[i].cnt * es2[j].cnt; 
            }
        }
        System.out.println((double)num/den);
    }
    private E[] make(int pl,int pr){
        int p=1;
        int to=1000000010;
        ArrayList<E> list=new ArrayList<E>();
        for(int i=0;i<ls.length;i++) {
            E e=new E(p,ls[i]-1);
            e.setCnt(pl,pr);
            list.add(e);
            e=new E(ls[i],ls[i]);
            e.setCnt(pl,pr);
            list.add(e);
            p=ls[i]+1;
        }       
        E e=new E(p,to);
        e.setCnt(pl,pr);
        list.add(e);
        return list.toArray(new E[0]);
    }
    class E{
        int l,r;

        private E(int l,int r){
            super();
            this.l=l;
            this.r=r;
        }

        int cnt;
        public void setCnt(int pl,int pr){
            if(r<pl || pr<l)return;
            cnt = min(r,pr) - max(l,pl) + 1;
        }
        
    }
    int[] tois(Integer[] Is){
        int[] is=new int[Is.length];
        for(int i=0;i<is.length;i++){
            is[i]=Is[i];
        }
        return is;
    }
    int[] ls;
    
    int nextInt(){
        try{
            int c=System.in.read();
            if(c==-1) return c;
            while(c!='-'&&(c<'0'||'9'<c)){
                c=System.in.read();
                if(c==-1) return c;
            }
            if(c=='-') return -nextInt();
            int res=0;
            do{
                res*=10;
                res+=c-'0';
                c=System.in.read();
            }while('0'<=c&&c<='9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }
    
    long nextLong(){
        try{
            int c=System.in.read();
            if(c==-1) return -1;
            while(c!='-'&&(c<'0'||'9'<c)){
                c=System.in.read();
                if(c==-1) return -1;
            }
            if(c=='-') return -nextLong();
            long res=0;
            do{
                res*=10;
                res+=c-'0';
                c=System.in.read();
            }while('0'<=c&&c<='9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }
    
    double nextDouble(){
        return Double.parseDouble(next());
    }
    
    String next(){
        try{
            StringBuilder res=new StringBuilder("");
            int c=System.in.read();
            while(Character.isWhitespace(c))
                c=System.in.read();
            do{
                res.append((char)c);
            }while(!Character.isWhitespace(c=System.in.read()));
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }
    
    String nextLine(){
        try{
            StringBuilder res=new StringBuilder("");
            int c=System.in.read();
            while(c=='\r'||c=='\n')
                c=System.in.read();
            do{
                res.append((char)c);
                c=System.in.read();
            }while(c!='\r'&&c!='\n');
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }
    public static void main(String[] args){
        new Main().run();
    }
}