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

public class B implements Runnable {

    public void solve() throws IOException {
      int a = in.nextInt();
      int b = in.nextInt();
      int c = in.nextInt();
      int d = in.nextInt();
      int k = in.nextInt();
      char[] x = new char[9];
      int prev = 0;
      int left = 4;
      Arrays.fill( x, '0' );
      x[8] = '4';
      char[] y = x.clone();
      for ( int i = 0; i < k - 1; i ++ ) {
        if ( !next( x ) ) {
          out.println( "0.0" );
          return;
        }
      }
      int right = new Integer( new String( x ) );
      int next = 1000000000;
      if ( next( x ) ) {
        next = new Integer( new String( x ) );
      }
      double r = 0.0;
      while ( true ) {
        r += Math.max( 0, Math.min( left, b ) - Math.max( prev + 1, a ) + 1 ) *
                1.0 * Math.max( 0, Math.min( next - 1, d ) - Math.max( right, c ) + 1 );
//        out.println( prev + " " + left + " " + right + " " + next + " " + r );
        r += Math.max( 0, Math.min( left, d ) - Math.max( prev + 1, c ) + 1 ) *
                1.0 * Math.max( 0, Math.min( next - 1, b ) - Math.max( right, a ) + 1 );
        if ( k == 1 && a <= left && left <= b && c <= left && left <= d ) {
          r -= 1.0;
        }
//        out.println( prev + " " + left + " " + right + " " + next + " " + r );
        prev = left;
        next( y );
        left = new Integer( new String( y ) );
        right = next;
        if ( right > Math.max( b, d ) ) {
          break;
        }
        if ( ! next( x ) ) {
          next = 1000000001;
        } else {
          next = new Integer( new String( x ) );
        }
      }
      out.println( r / ( b - a + 1 ) / ( d - c + 1 ) );
    }

  private boolean next( char[] x ) {
    int i = x.length - 1;
    while ( i >= 0 && x[i] == '7' ) {
      i --;
    }
    if ( i < 0 ) {
      return false;
    }
    if ( x[i] == '4' ) {
      x[i] = '7';
    } else {
      x[i] = '4';
    }
    for ( int j = i + 1; j < 9; j ++ ) {
      x[j] = '4';
    }
    return true;
  }

  public Scanner in;

    public PrintWriter out;

    B() throws IOException {
        in = new Scanner(System.in);
        // in = new StreamTokenizer( new InputStreamReader( System.in ) );
        out = new PrintWriter(System.out);
    }

//    int nextInt() throws IOException {
//        in.nextToken();
//        return ( int ) in.nval;
//    }

    void check(boolean f, String msg) {
        if (!f) {
            out.close();
            throw new RuntimeException(msg);
        }
    }

    void close() throws IOException {
        out.close();
    }

    public void run() {
        try {
            solve();
            close();
        } catch (Exception e) {
            e.printStackTrace(out);
            out.flush();
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) throws IOException {
        new Thread(new B()).start();
    }
}