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.util.*;

public class Main implements Runnable
{
	void solve() throws IOException 
    {
		int pl = sc.nextInt();
		int pr = sc.nextInt();
		int vl = sc.nextInt();
		int vr = sc.nextInt();
		int k = sc.nextInt();
		ArrayList<Long> lucky = new ArrayList<Long>();
		lucky.add((long)Math.min(pl,vl)-1);
		long curr = 4;
		while(curr <= Math.max(pr, vr))
		{
			lucky.add(curr);
			curr = next(curr);
		}
		lucky.add((long)Math.max(pr, vr)+1);
//		for(int i=0;i<lucky.size();i++)
//			System.out.print(lucky.get(i)+" ");
//		System.out.println();
		double p=0,p1,p2,p3,p4,p5;
		long a1,a2,b1,b2;
		for(int i=1;i+k<lucky.size();i++)
		{
			if(lucky.get(i)<Math.min(pl,vl)) continue;
			a1 = lucky.get(i-1)+1;
			if(lucky.get(i-1)<Math.min(pl,vl))
				a1 = Math.min(pl,vl);
			a2 = lucky.get(i);
			b1 = lucky.get(i+k-1);
			b2 = lucky.get(i+k)-1;
//			System.out.println(a1+" "+a2+" "+b1+" "+b2);
			p1 = prob(pl,pr,a1,a2);
			p2 = prob(vl,vr,b1,b2);
			p3 = prob(vl,vr,a1,a2);
			p4 = prob(pl,pr,b1,b2);
//			System.out.println(p1+" "+p2+" "+p3+" "+p4);
			p += ((p1*p2)+(p3*p4));
			if(a2==b1)
			{
				p5 = prob(pl,pr,a2,a2)*prob(vl,vr,a2,a2);
				p -= p5; 
			}
		}
		// if(p>1) p=1;
		ps.printf("%.12f",p);
    }

	private double prob(int pl, int pr, long a1, long a2) 
	{
		//System.out.println(pl+" "+pr+" "+a1+" "+a2);
		if(pl > a2 || pr < a1) return 0;
		if(pl>=a1 && pr <= a2) return 1;
		if(pl>=a1) return (a2-pl+1)/((double)(pr-pl+1));
		if(pr<=a2) return (pr-a1+1)/((double)(pr-pl+1));
		else return (a2-a1+1)/((double)(pr-pl+1));
	}

	private long next(long curr)
	{
		if(curr%10==4) return curr+3;
		long a = curr;
		int k = 0;
		while(a%10!=4&&a>0)
		{
			a/=10;
			k++;
		}
		if(a > 0) a+=3;
		else a = 4;			
		for(int i=0;i<k;i++)
			a = (10*a)+4;
		return a;
	}

	Scanner sc;
	PrintStream ps;
	
    public void run() 
    {
		try
		{
			sc = new Scanner(System.in);
			// sc = new Scanner(new File("a.in"));
			ps = new PrintStream(System.out);
			solve();
			sc.close();
			ps.close();
		} 
		catch (IOException e) 
		{
			e.printStackTrace();
			System.exit(0);
		}
    }
    
    public static void main(String[] args) 
    {
		new Thread(new Main()).start();
    }    
}