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.Arrays;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        long[] a = new long[]{0L,
                4L, 
                44L, 
                444L, 
                4444L, 
                44444L, 
                444444L, 
                4444444L, 
                44444444L, 
                444444444L, 
                4444444444L, 
                4444444447L, 
                444444447L, 
                4444444474L, 
                4444444477L, 
                44444447L, 
                444444474L, 
                4444444744L, 
                4444444747L, 
                444444477L, 
                4444444774L, 
                4444444777L, 
                4444447L, 
                44444474L, 
                444444744L, 
                4444447444L, 
                4444447447L, 
                444444747L, 
                4444447474L, 
                4444447477L, 
                44444477L, 
                444444774L, 
                4444447744L, 
                4444447747L, 
                444444777L, 
                4444447774L, 
                4444447777L, 
                444447L, 
                4444474L, 
                44444744L, 
                444447444L, 
                4444474444L, 
                4444474447L, 
                444447447L, 
                4444474474L, 
                4444474477L, 
                44444747L, 
                444447474L, 
                4444474744L, 
                4444474747L, 
                444447477L, 
                4444474774L, 
                4444474777L, 
                4444477L, 
                44444774L, 
                444447744L, 
                4444477444L, 
                4444477447L, 
                444447747L, 
                4444477474L, 
                4444477477L, 
                44444777L, 
                444447774L, 
                4444477744L, 
                4444477747L, 
                444447777L, 
                4444477774L, 
                4444477777L, 
                44447L, 
                444474L, 
                4444744L, 
                44447444L, 
                444474444L, 
                4444744444L, 
                4444744447L, 
                444474447L, 
                4444744474L, 
                4444744477L, 
                44447447L, 
                444474474L, 
                4444744744L, 
                4444744747L, 
                444474477L, 
                4444744774L, 
                4444744777L, 
                4444747L, 
                44447474L, 
                444474744L, 
                4444747444L, 
                4444747447L, 
                444474747L, 
                4444747474L, 
                4444747477L, 
                44447477L, 
                444474774L, 
                4444747744L, 
                4444747747L, 
                444474777L, 
                4444747774L, 
                4444747777L, 
                444477L, 
                4444774L, 
                44447744L, 
                444477444L, 
                4444774444L, 
                4444774447L, 
                444477447L, 
                4444774474L, 
                4444774477L, 
                44447747L, 
                444477474L, 
                4444774744L, 
                4444774747L, 
                444477477L, 
                4444774774L, 
                4444774777L, 
                4444777L, 
                44447774L, 
                444477744L, 
                4444777444L, 
                4444777447L, 
                444477747L, 
                4444777474L, 
                4444777477L, 
                44447777L, 
                444477774L, 
                4444777744L, 
                4444777747L, 
                444477777L, 
                4444777774L, 
                4444777777L, 
                4447L, 
                44474L, 
                444744L, 
                4447444L, 
                44474444L, 
                444744444L, 
                4447444444L, 
                4447444447L, 
                444744447L, 
                4447444474L, 
                4447444477L, 
                44474447L, 
                444744474L, 
                4447444744L, 
                4447444747L, 
                444744477L, 
                4447444774L, 
                4447444777L, 
                4447447L, 
                44474474L, 
                444744744L, 
                4447447444L, 
                4447447447L, 
                444744747L, 
                4447447474L, 
                4447447477L, 
                44474477L, 
                444744774L, 
                4447447744L, 
                4447447747L, 
                444744777L, 
                4447447774L, 
                4447447777L, 
                444747L, 
                4447474L, 
                44474744L, 
                444747444L, 
                4447474444L, 
                4447474447L, 
                444747447L, 
                4447474474L, 
                4447474477L, 
                44474747L, 
                444747474L, 
                4447474744L, 
                4447474747L, 
                444747477L, 
                4447474774L, 
                4447474777L, 
                4447477L, 
                44474774L, 
                444747744L, 
                4447477444L, 
                4447477447L, 
                444747747L, 
                4447477474L, 
                4447477477L, 
                44474777L, 
                444747774L, 
                4447477744L, 
                4447477747L, 
                444747777L, 
                4447477774L, 
                4447477777L, 
                44477L, 
                444774L, 
                4447744L, 
                44477444L, 
                444774444L, 
                4447744444L, 
                4447744447L, 
                444774447L, 
                4447744474L, 
                4447744477L, 
                44477447L, 
                444774474L, 
                4447744744L, 
                4447744747L, 
                444774477L, 
                4447744774L, 
                4447744777L, 
                4447747L, 
                44477474L, 
                444774744L, 
                4447747444L, 
                4447747447L, 
                444774747L, 
                4447747474L, 
                4447747477L, 
                44477477L, 
                444774774L, 
                4447747744L, 
                4447747747L, 
                444774777L, 
                4447747774L, 
                4447747777L, 
                444777L, 
                4447774L, 
                44477744L, 
                444777444L, 
                4447774444L, 
                4447774447L, 
                444777447L, 
                4447774474L, 
                4447774477L, 
                44477747L, 
                444777474L, 
                4447774744L, 
                4447774747L, 
                444777477L, 
                4447774774L, 
                4447774777L, 
                4447777L, 
                44477774L, 
                444777744L, 
                4447777444L, 
                4447777447L, 
                444777747L, 
                4447777474L, 
                4447777477L, 
                44477777L, 
                444777774L, 
                4447777744L, 
                4447777747L, 
                444777777L, 
                4447777774L, 
                4447777777L, 
                447L, 
                4474L, 
                44744L, 
                447444L, 
                4474444L, 
                44744444L, 
                447444444L, 
                4474444444L, 
                4474444447L, 
                447444447L, 
                4474444474L, 
                4474444477L, 
                44744447L, 
                447444474L, 
                4474444744L, 
                4474444747L, 
                447444477L, 
                4474444774L, 
                4474444777L, 
                4474447L, 
                44744474L, 
                447444744L, 
                4474447444L, 
                4474447447L, 
                447444747L, 
                4474447474L, 
                4474447477L, 
                44744477L, 
                447444774L, 
                4474447744L, 
                4474447747L, 
                447444777L, 
                4474447774L, 
                4474447777L, 
                447447L, 
                4474474L, 
                44744744L, 
                447447444L, 
                4474474444L, 
                4474474447L, 
                447447447L, 
                4474474474L, 
                4474474477L, 
                44744747L, 
                447447474L, 
                4474474744L, 
                4474474747L, 
                447447477L, 
                4474474774L, 
                4474474777L, 
                4474477L, 
                44744774L, 
                447447744L, 
                4474477444L, 
                4474477447L, 
                447447747L, 
                4474477474L, 
                4474477477L, 
                44744777L, 
                447447774L, 
                4474477744L, 
                4474477747L, 
                447447777L, 
                4474477774L, 
                4474477777L, 
                44747L, 
                447474L, 
                4474744L, 
                44747444L, 
                447474444L, 
                4474744444L, 
                4474744447L, 
                447474447L, 
                4474744474L, 
                4474744477L, 
                44747447L, 
                447474474L, 
                4474744744L, 
                4474744747L, 
                447474477L, 
                4474744774L, 
                4474744777L, 
                4474747L, 
                44747474L, 
                447474744L, 
                4474747444L, 
                4474747447L, 
                447474747L, 
                4474747474L, 
                4474747477L, 
                44747477L, 
                447474774L, 
                4474747744L, 
                4474747747L, 
                447474777L, 
                4474747774L, 
                4474747777L, 
                447477L, 
                4474774L, 
                44747744L, 
                447477444L, 
                4474774444L, 
                4474774447L, 
                447477447L, 
                4474774474L, 
                4474774477L, 
                44747747L, 
                447477474L, 
                4474774744L, 
                4474774747L, 
                447477477L, 
                4474774774L, 
                4474774777L, 
                4474777L, 
                44747774L, 
                447477744L, 
                4474777444L, 
                4474777447L, 
                447477747L, 
                4474777474L, 
                4474777477L, 
                44747777L, 
                447477774L, 
                4474777744L, 
                4474777747L, 
                447477777L, 
                4474777774L, 
                4474777777L, 
                4477L, 
                44774L, 
                447744L, 
                4477444L, 
                44774444L, 
                447744444L, 
                4477444444L, 
                4477444447L, 
                447744447L, 
                4477444474L, 
                4477444477L, 
                44774447L, 
                447744474L, 
                4477444744L, 
                4477444747L, 
                447744477L, 
                4477444774L, 
                4477444777L, 
                4477447L, 
                44774474L, 
                447744744L, 
                4477447444L, 
                4477447447L, 
                447744747L, 
                4477447474L, 
                4477447477L, 
                44774477L, 
                447744774L, 
                4477447744L, 
                4477447747L, 
                447744777L, 
                4477447774L, 
                4477447777L, 
                447747L, 
                4477474L, 
                44774744L, 
                447747444L, 
                4477474444L, 
                4477474447L, 
                447747447L, 
                4477474474L, 
                4477474477L, 
                44774747L, 
                447747474L, 
                4477474744L, 
                4477474747L, 
                447747477L, 
                4477474774L, 
                4477474777L, 
                4477477L, 
                44774774L, 
                447747744L, 
                4477477444L, 
                4477477447L, 
                447747747L, 
                4477477474L, 
                4477477477L, 
                44774777L, 
                447747774L, 
                4477477744L, 
                4477477747L, 
                447747777L, 
                4477477774L, 
                4477477777L, 
                44777L, 
                447774L, 
                4477744L, 
                44777444L, 
                447774444L, 
                4477744444L, 
                4477744447L, 
                447774447L, 
                4477744474L, 
                4477744477L, 
                44777447L, 
                447774474L, 
                4477744744L, 
                4477744747L, 
                447774477L, 
                4477744774L, 
                4477744777L, 
                4477747L, 
                44777474L, 
                447774744L, 
                4477747444L, 
                4477747447L, 
                447774747L, 
                4477747474L, 
                4477747477L, 
                44777477L, 
                447774774L, 
                4477747744L, 
                4477747747L, 
                447774777L, 
                4477747774L, 
                4477747777L, 
                447777L, 
                4477774L, 
                44777744L, 
                447777444L, 
                4477774444L, 
                4477774447L, 
                447777447L, 
                4477774474L, 
                4477774477L, 
                44777747L, 
                447777474L, 
                4477774744L, 
                4477774747L, 
                447777477L, 
                4477774774L, 
                4477774777L, 
                4477777L, 
                44777774L, 
                447777744L, 
                4477777444L, 
                4477777447L, 
                447777747L, 
                4477777474L, 
                4477777477L, 
                44777777L, 
                447777774L, 
                4477777744L, 
                4477777747L, 
                447777777L, 
                4477777774L, 
                4477777777L, 
                47L, 
                474L, 
                4744L, 
                47444L, 
                474444L, 
                4744444L, 
                47444444L, 
                474444444L, 
                4744444444L, 
                4744444447L, 
                474444447L, 
                4744444474L, 
                4744444477L, 
                47444447L, 
                474444474L, 
                4744444744L, 
                4744444747L, 
                474444477L, 
                4744444774L, 
                4744444777L, 
                4744447L, 
                47444474L, 
                474444744L, 
                4744447444L, 
                4744447447L, 
                474444747L, 
                4744447474L, 
                4744447477L, 
                47444477L, 
                474444774L, 
                4744447744L, 
                4744447747L, 
                474444777L, 
                4744447774L, 
                4744447777L, 
                474447L, 
                4744474L, 
                47444744L, 
                474447444L, 
                4744474444L, 
                4744474447L, 
                474447447L, 
                4744474474L, 
                4744474477L, 
                47444747L, 
                474447474L, 
                4744474744L, 
                4744474747L, 
                474447477L, 
                4744474774L, 
                4744474777L, 
                4744477L, 
                47444774L, 
                474447744L, 
                4744477444L, 
                4744477447L, 
                474447747L, 
                4744477474L, 
                4744477477L, 
                47444777L, 
                474447774L, 
                4744477744L, 
                4744477747L, 
                474447777L, 
                4744477774L, 
                4744477777L, 
                47447L, 
                474474L, 
                4744744L, 
                47447444L, 
                474474444L, 
                4744744444L, 
                4744744447L, 
                474474447L, 
                4744744474L, 
                4744744477L, 
                47447447L, 
                474474474L, 
                4744744744L, 
                4744744747L, 
                474474477L, 
                4744744774L, 
                4744744777L, 
                4744747L, 
                47447474L, 
                474474744L, 
                4744747444L, 
                4744747447L, 
                474474747L, 
                4744747474L, 
                4744747477L, 
                47447477L, 
                474474774L, 
                4744747744L, 
                4744747747L, 
                474474777L, 
                4744747774L, 
                4744747777L, 
                474477L, 
                4744774L, 
                47447744L, 
                474477444L, 
                4744774444L, 
                4744774447L, 
                474477447L, 
                4744774474L, 
                4744774477L, 
                47447747L, 
                474477474L, 
                4744774744L, 
                4744774747L, 
                474477477L, 
                4744774774L, 
                4744774777L, 
                4744777L, 
                47447774L, 
                474477744L, 
                4744777444L, 
                4744777447L, 
                474477747L, 
                4744777474L, 
                4744777477L, 
                47447777L, 
                474477774L, 
                4744777744L, 
                4744777747L, 
                474477777L, 
                4744777774L, 
                4744777777L, 
                4747L, 
                47474L, 
                474744L, 
                4747444L, 
                47474444L, 
                474744444L, 
                4747444444L, 
                4747444447L, 
                474744447L, 
                4747444474L, 
                4747444477L, 
                47474447L, 
                474744474L, 
                4747444744L, 
                4747444747L, 
                474744477L, 
                4747444774L, 
                4747444777L, 
                4747447L, 
                47474474L, 
                474744744L, 
                4747447444L, 
                4747447447L, 
                474744747L, 
                4747447474L, 
                4747447477L, 
                47474477L, 
                474744774L, 
                4747447744L, 
                4747447747L, 
                474744777L, 
                4747447774L, 
                4747447777L, 
                474747L, 
                4747474L, 
                47474744L, 
                474747444L, 
                4747474444L, 
                4747474447L, 
                474747447L, 
                4747474474L, 
                4747474477L, 
                47474747L, 
                474747474L, 
                4747474744L, 
                4747474747L, 
                474747477L, 
                4747474774L, 
                4747474777L, 
                4747477L, 
                47474774L, 
                474747744L, 
                4747477444L, 
                4747477447L, 
                474747747L, 
                4747477474L, 
                4747477477L, 
                47474777L, 
                474747774L, 
                4747477744L, 
                4747477747L, 
                474747777L, 
                4747477774L, 
                4747477777L, 
                47477L, 
                474774L, 
                4747744L, 
                47477444L, 
                474774444L, 
                4747744444L, 
                4747744447L, 
                474774447L, 
                4747744474L, 
                4747744477L, 
                47477447L, 
                474774474L, 
                4747744744L, 
                4747744747L, 
                474774477L, 
                4747744774L, 
                4747744777L, 
                4747747L, 
                47477474L, 
                474774744L, 
                4747747444L, 
                4747747447L, 
                474774747L, 
                4747747474L, 
                4747747477L, 
                47477477L, 
                474774774L, 
                4747747744L, 
                4747747747L, 
                474774777L, 
                4747747774L, 
                4747747777L, 
                474777L, 
                4747774L, 
                47477744L, 
                474777444L, 
                4747774444L, 
                4747774447L, 
                474777447L, 
                4747774474L, 
                4747774477L, 
                47477747L, 
                474777474L, 
                4747774744L, 
                4747774747L, 
                474777477L, 
                4747774774L, 
                4747774777L, 
                4747777L, 
                47477774L, 
                474777744L, 
                4747777444L, 
                4747777447L, 
                474777747L, 
                4747777474L, 
                4747777477L, 
                47477777L, 
                474777774L, 
                4747777744L, 
                4747777747L, 
                474777777L, 
                4747777774L, 
                4747777777L, 
                477L, 
                4774L, 
                47744L, 
                477444L, 
                4774444L, 
                47744444L, 
                477444444L, 
                4774444444L, 
                4774444447L, 
                477444447L, 
                4774444474L, 
                4774444477L, 
                47744447L, 
                477444474L, 
                4774444744L, 
                4774444747L, 
                477444477L, 
                4774444774L, 
                4774444777L, 
                4774447L, 
                47744474L, 
                477444744L, 
                4774447444L, 
                4774447447L, 
                477444747L, 
                4774447474L, 
                4774447477L, 
                47744477L, 
                477444774L, 
                4774447744L, 
                4774447747L, 
                477444777L, 
                4774447774L, 
                4774447777L, 
                477447L, 
                4774474L, 
                47744744L, 
                477447444L, 
                4774474444L, 
                4774474447L, 
                477447447L, 
                4774474474L, 
                4774474477L, 
                47744747L, 
                477447474L, 
                4774474744L, 
                4774474747L, 
                477447477L, 
                4774474774L, 
                4774474777L, 
                4774477L, 
                47744774L, 
                477447744L, 
                4774477444L, 
                4774477447L, 
                477447747L, 
                4774477474L, 
                4774477477L, 
                47744777L, 
                477447774L, 
                4774477744L, 
                4774477747L, 
                477447777L, 
                4774477774L, 
                4774477777L, 
                47747L, 
                477474L, 
                4774744L, 
                47747444L, 
                477474444L, 
                4774744444L, 
                4774744447L, 
                477474447L, 
                4774744474L, 
                4774744477L, 
                47747447L, 
                477474474L, 
                4774744744L, 
                4774744747L, 
                477474477L, 
                4774744774L, 
                4774744777L, 
                4774747L, 
                47747474L, 
                477474744L, 
                4774747444L, 
                4774747447L, 
                477474747L, 
                4774747474L, 
                4774747477L, 
                47747477L, 
                477474774L, 
                4774747744L, 
                4774747747L, 
                477474777L, 
                4774747774L, 
                4774747777L, 
                477477L, 
                4774774L, 
                47747744L, 
                477477444L, 
                4774774444L, 
                4774774447L, 
                477477447L, 
                4774774474L, 
                4774774477L, 
                47747747L, 
                477477474L, 
                4774774744L, 
                4774774747L, 
                477477477L, 
                4774774774L, 
                4774774777L, 
                4774777L, 
                47747774L, 
                477477744L, 
                4774777444L, 
                4774777447L, 
                477477747L, 
                4774777474L, 
                4774777477L, 
                47747777L, 
                477477774L, 
                4774777744L, 
                4774777747L, 
                477477777L, 
                4774777774L, 
                4774777777L, 
                4777L, 
                47774L, 
                477744L, 
                4777444L, 
                47774444L, 
                477744444L, 
                4777444444L, 
                4777444447L, 
                477744447L, 
                4777444474L, 
                4777444477L, 
                47774447L, 
                477744474L, 
                4777444744L, 
                4777444747L, 
                477744477L, 
                4777444774L, 
                4777444777L, 
                4777447L, 
                47774474L, 
                477744744L, 
                4777447444L, 
                4777447447L, 
                477744747L, 
                4777447474L, 
                4777447477L, 
                47774477L, 
                477744774L, 
                4777447744L, 
                4777447747L, 
                477744777L, 
                4777447774L, 
                4777447777L, 
                477747L, 
                4777474L, 
                47774744L, 
                477747444L, 
                4777474444L, 
                4777474447L, 
                477747447L, 
                4777474474L, 
                4777474477L, 
                47774747L, 
                477747474L, 
                4777474744L, 
                4777474747L, 
                477747477L, 
                4777474774L, 
                4777474777L, 
                4777477L, 
                47774774L, 
                477747744L, 
                4777477444L, 
                4777477447L, 
                477747747L, 
                4777477474L, 
                4777477477L, 
                47774777L, 
                477747774L, 
                4777477744L, 
                4777477747L, 
                477747777L, 
                4777477774L, 
                4777477777L, 
                47777L, 
                477774L, 
                4777744L, 
                47777444L, 
                477774444L, 
                4777744444L, 
                4777744447L, 
                477774447L, 
                4777744474L, 
                4777744477L, 
                47777447L, 
                477774474L, 
                4777744744L, 
                4777744747L, 
                477774477L, 
                4777744774L, 
                4777744777L, 
                4777747L, 
                47777474L, 
                477774744L, 
                4777747444L, 
                4777747447L, 
                477774747L, 
                4777747474L, 
                4777747477L, 
                47777477L, 
                477774774L, 
                4777747744L, 
                4777747747L, 
                477774777L, 
                4777747774L, 
                4777747777L, 
                477777L, 
                4777774L, 
                47777744L, 
                477777444L, 
                4777774444L, 
                4777774447L, 
                477777447L, 
                4777774474L, 
                4777774477L, 
                47777747L, 
                477777474L, 
                4777774744L, 
                4777774747L, 
                477777477L, 
                4777774774L, 
                4777774777L, 
                4777777L, 
                47777774L, 
                477777744L, 
                4777777444L, 
                4777777447L, 
                477777747L, 
                4777777474L, 
                4777777477L, 
                47777777L, 
                477777774L, 
                4777777744L, 
                4777777747L, 
                477777777L, 
                4777777774L, 
                4777777777L, 
                7L, 
                74L, 
                744L, 
                7444L, 
                74444L, 
                744444L, 
                7444444L, 
                74444444L, 
                744444444L, 
                7444444444L, 
                7444444447L, 
                744444447L, 
                7444444474L, 
                7444444477L, 
                74444447L, 
                744444474L, 
                7444444744L, 
                7444444747L, 
                744444477L, 
                7444444774L, 
                7444444777L, 
                7444447L, 
                74444474L, 
                744444744L, 
                7444447444L, 
                7444447447L, 
                744444747L, 
                7444447474L, 
                7444447477L, 
                74444477L, 
                744444774L, 
                7444447744L, 
                7444447747L, 
                744444777L, 
                7444447774L, 
                7444447777L, 
                744447L, 
                7444474L, 
                74444744L, 
                744447444L, 
                7444474444L, 
                7444474447L, 
                744447447L, 
                7444474474L, 
                7444474477L, 
                74444747L, 
                744447474L, 
                7444474744L, 
                7444474747L, 
                744447477L, 
                7444474774L, 
                7444474777L, 
                7444477L, 
                74444774L, 
                744447744L, 
                7444477444L, 
                7444477447L, 
                744447747L, 
                7444477474L, 
                7444477477L, 
                74444777L, 
                744447774L, 
                7444477744L, 
                7444477747L, 
                744447777L, 
                7444477774L, 
                7444477777L, 
                74447L, 
                744474L, 
                7444744L, 
                74447444L, 
                744474444L, 
                7444744444L, 
                7444744447L, 
                744474447L, 
                7444744474L, 
                7444744477L, 
                74447447L, 
                744474474L, 
                7444744744L, 
                7444744747L, 
                744474477L, 
                7444744774L, 
                7444744777L, 
                7444747L, 
                74447474L, 
                744474744L, 
                7444747444L, 
                7444747447L, 
                744474747L, 
                7444747474L, 
                7444747477L, 
                74447477L, 
                744474774L, 
                7444747744L, 
                7444747747L, 
                744474777L, 
                7444747774L, 
                7444747777L, 
                744477L, 
                7444774L, 
                74447744L, 
                744477444L, 
                7444774444L, 
                7444774447L, 
                744477447L, 
                7444774474L, 
                7444774477L, 
                74447747L, 
                744477474L, 
                7444774744L, 
                7444774747L, 
                744477477L, 
                7444774774L, 
                7444774777L, 
                7444777L, 
                74447774L, 
                744477744L, 
                7444777444L, 
                7444777447L, 
                744477747L, 
                7444777474L, 
                7444777477L, 
                74447777L, 
                744477774L, 
                7444777744L, 
                7444777747L, 
                744477777L, 
                7444777774L, 
                7444777777L, 
                7447L, 
                74474L, 
                744744L, 
                7447444L, 
                74474444L, 
                744744444L, 
                7447444444L, 
                7447444447L, 
                744744447L, 
                7447444474L, 
                7447444477L, 
                74474447L, 
                744744474L, 
                7447444744L, 
                7447444747L, 
                744744477L, 
                7447444774L, 
                7447444777L, 
                7447447L, 
                74474474L, 
                744744744L, 
                7447447444L, 
                7447447447L, 
                744744747L, 
                7447447474L, 
                7447447477L, 
                74474477L, 
                744744774L, 
                7447447744L, 
                7447447747L, 
                744744777L, 
                7447447774L, 
                7447447777L, 
                744747L, 
                7447474L, 
                74474744L, 
                744747444L, 
                7447474444L, 
                7447474447L, 
                744747447L, 
                7447474474L, 
                7447474477L, 
                74474747L, 
                744747474L, 
                7447474744L, 
                7447474747L, 
                744747477L, 
                7447474774L, 
                7447474777L, 
                7447477L, 
                74474774L, 
                744747744L, 
                7447477444L, 
                7447477447L, 
                744747747L, 
                7447477474L, 
                7447477477L, 
                74474777L, 
                744747774L, 
                7447477744L, 
                7447477747L, 
                744747777L, 
                7447477774L, 
                7447477777L, 
                74477L, 
                744774L, 
                7447744L, 
                74477444L, 
                744774444L, 
                7447744444L, 
                7447744447L, 
                744774447L, 
                7447744474L, 
                7447744477L, 
                74477447L, 
                744774474L, 
                7447744744L, 
                7447744747L, 
                744774477L, 
                7447744774L, 
                7447744777L, 
                7447747L, 
                74477474L, 
                744774744L, 
                7447747444L, 
                7447747447L, 
                744774747L, 
                7447747474L, 
                7447747477L, 
                74477477L, 
                744774774L, 
                7447747744L, 
                7447747747L, 
                744774777L, 
                7447747774L, 
                7447747777L, 
                744777L, 
                7447774L, 
                74477744L, 
                744777444L, 
                7447774444L, 
                7447774447L, 
                744777447L, 
                7447774474L, 
                7447774477L, 
                74477747L, 
                744777474L, 
                7447774744L, 
                7447774747L, 
                744777477L, 
                7447774774L, 
                7447774777L, 
                7447777L, 
                74477774L, 
                744777744L, 
                7447777444L, 
                7447777447L, 
                744777747L, 
                7447777474L, 
                7447777477L, 
                74477777L, 
                744777774L, 
                7447777744L, 
                7447777747L, 
                744777777L, 
                7447777774L, 
                7447777777L, 
                747L, 
                7474L, 
                74744L, 
                747444L, 
                7474444L, 
                74744444L, 
                747444444L, 
                7474444444L, 
                7474444447L, 
                747444447L, 
                7474444474L, 
                7474444477L, 
                74744447L, 
                747444474L, 
                7474444744L, 
                7474444747L, 
                747444477L, 
                7474444774L, 
                7474444777L, 
                7474447L, 
                74744474L, 
                747444744L, 
                7474447444L, 
                7474447447L, 
                747444747L, 
                7474447474L, 
                7474447477L, 
                74744477L, 
                747444774L, 
                7474447744L, 
                7474447747L, 
                747444777L, 
                7474447774L, 
                7474447777L, 
                747447L, 
                7474474L, 
                74744744L, 
                747447444L, 
                7474474444L, 
                7474474447L, 
                747447447L, 
                7474474474L, 
                7474474477L, 
                74744747L, 
                747447474L, 
                7474474744L, 
                7474474747L, 
                747447477L, 
                7474474774L, 
                7474474777L, 
                7474477L, 
                74744774L, 
                747447744L, 
                7474477444L, 
                7474477447L, 
                747447747L, 
                7474477474L, 
                7474477477L, 
                74744777L, 
                747447774L, 
                7474477744L, 
                7474477747L, 
                747447777L, 
                7474477774L, 
                7474477777L, 
                74747L, 
                747474L, 
                7474744L, 
                74747444L, 
                747474444L, 
                7474744444L, 
                7474744447L, 
                747474447L, 
                7474744474L, 
                7474744477L, 
                74747447L, 
                747474474L, 
                7474744744L, 
                7474744747L, 
                747474477L, 
                7474744774L, 
                7474744777L, 
                7474747L, 
                74747474L, 
                747474744L, 
                7474747444L, 
                7474747447L, 
                747474747L, 
                7474747474L, 
                7474747477L, 
                74747477L, 
                747474774L, 
                7474747744L, 
                7474747747L, 
                747474777L, 
                7474747774L, 
                7474747777L, 
                747477L, 
                7474774L, 
                74747744L, 
                747477444L, 
                7474774444L, 
                7474774447L, 
                747477447L, 
                7474774474L, 
                7474774477L, 
                74747747L, 
                747477474L, 
                7474774744L, 
                7474774747L, 
                747477477L, 
                7474774774L, 
                7474774777L, 
                7474777L, 
                74747774L, 
                747477744L, 
                7474777444L, 
                7474777447L, 
                747477747L, 
                7474777474L, 
                7474777477L, 
                74747777L, 
                747477774L, 
                7474777744L, 
                7474777747L, 
                747477777L, 
                7474777774L, 
                7474777777L, 
                7477L, 
                74774L, 
                747744L, 
                7477444L, 
                74774444L, 
                747744444L, 
                7477444444L, 
                7477444447L, 
                747744447L, 
                7477444474L, 
                7477444477L, 
                74774447L, 
                747744474L, 
                7477444744L, 
                7477444747L, 
                747744477L, 
                7477444774L, 
                7477444777L, 
                7477447L, 
                74774474L, 
                747744744L, 
                7477447444L, 
                7477447447L, 
                747744747L, 
                7477447474L, 
                7477447477L, 
                74774477L, 
                747744774L, 
                7477447744L, 
                7477447747L, 
                747744777L, 
                7477447774L, 
                7477447777L, 
                747747L, 
                7477474L, 
                74774744L, 
                747747444L, 
                7477474444L, 
                7477474447L, 
                747747447L, 
                7477474474L, 
                7477474477L, 
                74774747L, 
                747747474L, 
                7477474744L, 
                7477474747L, 
                747747477L, 
                7477474774L, 
                7477474777L, 
                7477477L, 
                74774774L, 
                747747744L, 
                7477477444L, 
                7477477447L, 
                747747747L, 
                7477477474L, 
                7477477477L, 
                74774777L, 
                747747774L, 
                7477477744L, 
                7477477747L, 
                747747777L, 
                7477477774L, 
                7477477777L, 
                74777L, 
                747774L, 
                7477744L, 
                74777444L, 
                747774444L, 
                7477744444L, 
                7477744447L, 
                747774447L, 
                7477744474L, 
                7477744477L, 
                74777447L, 
                747774474L, 
                7477744744L, 
                7477744747L, 
                747774477L, 
                7477744774L, 
                7477744777L, 
                7477747L, 
                74777474L, 
                747774744L, 
                7477747444L, 
                7477747447L, 
                747774747L, 
                7477747474L, 
                7477747477L, 
                74777477L, 
                747774774L, 
                7477747744L, 
                7477747747L, 
                747774777L, 
                7477747774L, 
                7477747777L, 
                747777L, 
                7477774L, 
                74777744L, 
                747777444L, 
                7477774444L, 
                7477774447L, 
                747777447L, 
                7477774474L, 
                7477774477L, 
                74777747L, 
                747777474L, 
                7477774744L, 
                7477774747L, 
                747777477L, 
                7477774774L, 
                7477774777L, 
                7477777L, 
                74777774L, 
                747777744L, 
                7477777444L, 
                7477777447L, 
                747777747L, 
                7477777474L, 
                7477777477L, 
                74777777L, 
                747777774L, 
                7477777744L, 
                7477777747L, 
                747777777L, 
                7477777774L, 
                7477777777L, 
                77L, 
                774L, 
                7744L, 
                77444L, 
                774444L, 
                7744444L, 
                77444444L, 
                774444444L, 
                7744444444L, 
                7744444447L, 
                774444447L, 
                7744444474L, 
                7744444477L, 
                77444447L, 
                774444474L, 
                7744444744L, 
                7744444747L, 
                774444477L, 
                7744444774L, 
                7744444777L, 
                7744447L, 
                77444474L, 
                774444744L, 
                7744447444L, 
                7744447447L, 
                774444747L, 
                7744447474L, 
                7744447477L, 
                77444477L, 
                774444774L, 
                7744447744L, 
                7744447747L, 
                774444777L, 
                7744447774L, 
                7744447777L, 
                774447L, 
                7744474L, 
                77444744L, 
                774447444L, 
                7744474444L, 
                7744474447L, 
                774447447L, 
                7744474474L, 
                7744474477L, 
                77444747L, 
                774447474L, 
                7744474744L, 
                7744474747L, 
                774447477L, 
                7744474774L, 
                7744474777L, 
                7744477L, 
                77444774L, 
                774447744L, 
                7744477444L, 
                7744477447L, 
                774447747L, 
                7744477474L, 
                7744477477L, 
                77444777L, 
                774447774L, 
                7744477744L, 
                7744477747L, 
                774447777L, 
                7744477774L, 
                7744477777L, 
                77447L, 
                774474L, 
                7744744L, 
                77447444L, 
                774474444L, 
                7744744444L, 
                7744744447L, 
                774474447L, 
                7744744474L, 
                7744744477L, 
                77447447L, 
                774474474L, 
                7744744744L, 
                7744744747L, 
                774474477L, 
                7744744774L, 
                7744744777L, 
                7744747L, 
                77447474L, 
                774474744L, 
                7744747444L, 
                7744747447L, 
                774474747L, 
                7744747474L, 
                7744747477L, 
                77447477L, 
                774474774L, 
                7744747744L, 
                7744747747L, 
                774474777L, 
                7744747774L, 
                7744747777L, 
                774477L, 
                7744774L, 
                77447744L, 
                774477444L, 
                7744774444L, 
                7744774447L, 
                774477447L, 
                7744774474L, 
                7744774477L, 
                77447747L, 
                774477474L, 
                7744774744L, 
                7744774747L, 
                774477477L, 
                7744774774L, 
                7744774777L, 
                7744777L, 
                77447774L, 
                774477744L, 
                7744777444L, 
                7744777447L, 
                774477747L, 
                7744777474L, 
                7744777477L, 
                77447777L, 
                774477774L, 
                7744777744L, 
                7744777747L, 
                774477777L, 
                7744777774L, 
                7744777777L, 
                7747L, 
                77474L, 
                774744L, 
                7747444L, 
                77474444L, 
                774744444L, 
                7747444444L, 
                7747444447L, 
                774744447L, 
                7747444474L, 
                7747444477L, 
                77474447L, 
                774744474L, 
                7747444744L, 
                7747444747L, 
                774744477L, 
                7747444774L, 
                7747444777L, 
                7747447L, 
                77474474L, 
                774744744L, 
                7747447444L, 
                7747447447L, 
                774744747L, 
                7747447474L, 
                7747447477L, 
                77474477L, 
                774744774L, 
                7747447744L, 
                7747447747L, 
                774744777L, 
                7747447774L, 
                7747447777L, 
                774747L, 
                7747474L, 
                77474744L, 
                774747444L, 
                7747474444L, 
                7747474447L, 
                774747447L, 
                7747474474L, 
                7747474477L, 
                77474747L, 
                774747474L, 
                7747474744L, 
                7747474747L, 
                774747477L, 
                7747474774L, 
                7747474777L, 
                7747477L, 
                77474774L, 
                774747744L, 
                7747477444L, 
                7747477447L, 
                774747747L, 
                7747477474L, 
                7747477477L, 
                77474777L, 
                774747774L, 
                7747477744L, 
                7747477747L, 
                774747777L, 
                7747477774L, 
                7747477777L, 
                77477L, 
                774774L, 
                7747744L, 
                77477444L, 
                774774444L, 
                7747744444L, 
                7747744447L, 
                774774447L, 
                7747744474L, 
                7747744477L, 
                77477447L, 
                774774474L, 
                7747744744L, 
                7747744747L, 
                774774477L, 
                7747744774L, 
                7747744777L, 
                7747747L, 
                77477474L, 
                774774744L, 
                7747747444L, 
                7747747447L, 
                774774747L, 
                7747747474L, 
                7747747477L, 
                77477477L, 
                774774774L, 
                7747747744L, 
                7747747747L, 
                774774777L, 
                7747747774L, 
                7747747777L, 
                774777L, 
                7747774L, 
                77477744L, 
                774777444L, 
                7747774444L, 
                7747774447L, 
                774777447L, 
                7747774474L, 
                7747774477L, 
                77477747L, 
                774777474L, 
                7747774744L, 
                7747774747L, 
                774777477L, 
                7747774774L, 
                7747774777L, 
                7747777L, 
                77477774L, 
                774777744L, 
                7747777444L, 
                7747777447L, 
                774777747L, 
                7747777474L, 
                7747777477L, 
                77477777L, 
                774777774L, 
                7747777744L, 
                7747777747L, 
                774777777L, 
                7747777774L, 
                7747777777L, 
                777L, 
                7774L, 
                77744L, 
                777444L, 
                7774444L, 
                77744444L, 
                777444444L, 
                7774444444L, 
                7774444447L, 
                777444447L, 
                7774444474L, 
                7774444477L, 
                77744447L, 
                777444474L, 
                7774444744L, 
                7774444747L, 
                777444477L, 
                7774444774L, 
                7774444777L, 
                7774447L, 
                77744474L, 
                777444744L, 
                7774447444L, 
                7774447447L, 
                777444747L, 
                7774447474L, 
                7774447477L, 
                77744477L, 
                777444774L, 
                7774447744L, 
                7774447747L, 
                777444777L, 
                7774447774L, 
                7774447777L, 
                777447L, 
                7774474L, 
                77744744L, 
                777447444L, 
                7774474444L, 
                7774474447L, 
                777447447L, 
                7774474474L, 
                7774474477L, 
                77744747L, 
                777447474L, 
                7774474744L, 
                7774474747L, 
                777447477L, 
                7774474774L, 
                7774474777L, 
                7774477L, 
                77744774L, 
                777447744L, 
                7774477444L, 
                7774477447L, 
                777447747L, 
                7774477474L, 
                7774477477L, 
                77744777L, 
                777447774L, 
                7774477744L, 
                7774477747L, 
                777447777L, 
                7774477774L, 
                7774477777L, 
                77747L, 
                777474L, 
                7774744L, 
                77747444L, 
                777474444L, 
                7774744444L, 
                7774744447L, 
                777474447L, 
                7774744474L, 
                7774744477L, 
                77747447L, 
                777474474L, 
                7774744744L, 
                7774744747L, 
                777474477L, 
                7774744774L, 
                7774744777L, 
                7774747L, 
                77747474L, 
                777474744L, 
                7774747444L, 
                7774747447L, 
                777474747L, 
                7774747474L, 
                7774747477L, 
                77747477L, 
                777474774L, 
                7774747744L, 
                7774747747L, 
                777474777L, 
                7774747774L, 
                7774747777L, 
                777477L, 
                7774774L, 
                77747744L, 
                777477444L, 
                7774774444L, 
                7774774447L, 
                777477447L, 
                7774774474L, 
                7774774477L, 
                77747747L, 
                777477474L, 
                7774774744L, 
                7774774747L, 
                777477477L, 
                7774774774L, 
                7774774777L, 
                7774777L, 
                77747774L, 
                777477744L, 
                7774777444L, 
                7774777447L, 
                777477747L, 
                7774777474L, 
                7774777477L, 
                77747777L, 
                777477774L, 
                7774777744L, 
                7774777747L, 
                777477777L, 
                7774777774L, 
                7774777777L, 
                7777L, 
                77774L, 
                777744L, 
                7777444L, 
                77774444L, 
                777744444L, 
                7777444444L, 
                7777444447L, 
                777744447L, 
                7777444474L, 
                7777444477L, 
                77774447L, 
                777744474L, 
                7777444744L, 
                7777444747L, 
                777744477L, 
                7777444774L, 
                7777444777L, 
                7777447L, 
                77774474L, 
                777744744L, 
                7777447444L, 
                7777447447L, 
                777744747L, 
                7777447474L, 
                7777447477L, 
                77774477L, 
                777744774L, 
                7777447744L, 
                7777447747L, 
                777744777L, 
                7777447774L, 
                7777447777L, 
                777747L, 
                7777474L, 
                77774744L, 
                777747444L, 
                7777474444L, 
                7777474447L, 
                777747447L, 
                7777474474L, 
                7777474477L, 
                77774747L, 
                777747474L, 
                7777474744L, 
                7777474747L, 
                777747477L, 
                7777474774L, 
                7777474777L, 
                7777477L, 
                77774774L, 
                777747744L, 
                7777477444L, 
                7777477447L, 
                777747747L, 
                7777477474L, 
                7777477477L, 
                77774777L, 
                777747774L, 
                7777477744L, 
                7777477747L, 
                777747777L, 
                7777477774L, 
                7777477777L, 
                77777L, 
                777774L, 
                7777744L, 
                77777444L, 
                777774444L, 
                7777744444L, 
                7777744447L, 
                777774447L, 
                7777744474L, 
                7777744477L, 
                77777447L, 
                777774474L, 
                7777744744L, 
                7777744747L, 
                777774477L, 
                7777744774L, 
                7777744777L, 
                7777747L, 
                77777474L, 
                777774744L, 
                7777747444L, 
                7777747447L, 
                777774747L, 
                7777747474L, 
                7777747477L, 
                77777477L, 
                777774774L, 
                7777747744L, 
                7777747747L, 
                777774777L, 
                7777747774L, 
                7777747777L, 
                777777L, 
                7777774L, 
                77777744L, 
                777777444L, 
                7777774444L, 
                7777774447L, 
                777777447L, 
                7777774474L, 
                7777774477L, 
                77777747L, 
                777777474L, 
                7777774744L, 
                7777774747L, 
                777777477L, 
                7777774774L, 
                7777774777L, 
                7777777L, 
                77777774L, 
                777777744L, 
                7777777444L, 
                7777777447L, 
                777777747L, 
                7777777474L, 
                7777777477L, 
                77777777L, 
                777777774L, 
                7777777744L, 
                7777777747L, 
                777777777L, 
                7777777774L, 
                7777777777L, 
};
        Arrays.sort(a);
                
        Scanner r = new Scanner(System.in);
        int[] p = new int[2], v = new int[2];
        p[0] = r.nextInt();
        p[1] = r.nextInt();
        
        v[0] = r.nextInt();
        v[1] = r.nextInt();
        
        int k = r.nextInt();
        
        long res = 0;
        for(int i = 0; i < a.length; i++){
            int j = i+k-1;
            if(j >= a.length-1)break;
            
            double add = go(v, p, i, j, a) + go(p, v, i, j, a);  
            res += add;
            
            if(k == 1 && (p[1] >= v[0] && p[0] <= v[1]) && add > 0)res--;
        }
        
        long all = ((long)(p[1]-p[0]+1)) * ((long)(v[1]-v[0]+1));
        
        System.out.printf("%.9f\n" , res*1.0/all);
    }


    private static long go(int[] p, int[] v, int i, int j, long[] a) {
        long res = 0;
        long prev = Math.max(p[0], i-1 >= 0?a[i-1]+1:1);
        long next = Math.min(v[1], a[j+1]-1);

        long upper = Math.min(p[1], a[i]);
        long lower = Math.max(v[0], a[j]);
        
        if(upper < prev || next < lower)return 0;
        
        res += (upper-prev+1L)*(next-lower+1L); 
        return res;
    }

}