Problem: It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills.

According to the borscht recipe it consists of n ingredients that have to be mixed in proportion <image> litres (thus, there should be a1 ·x, ..., an ·x litres of corresponding ingredients mixed for some non-negative x). In the kitchen Volodya found out that he has b1, ..., bn litres of these ingredients at his disposal correspondingly. In order to correct his algebra mistakes he ought to cook as much soup as possible in a V litres volume pan (which means the amount of soup cooked can be between 0 and V litres). What is the volume of borscht Volodya will cook ultimately?

Input

The first line of the input contains two space-separated integers n and V (1 ≤ n ≤ 20, 1 ≤ V ≤ 10000). The next line contains n space-separated integers ai (1 ≤ ai ≤ 100). Finally, the last line contains n space-separated integers bi (0 ≤ bi ≤ 100).

Output

Your program should output just one real number — the volume of soup that Volodya will cook. Your answer must have a relative or absolute error less than 10 - 4.

Examples

Input

1 100
1
40


Output

40.0


Input

2 100
1 1
25 30


Output

50.0


Input

2 100
1 1
60 60


Output

100.0

Solution (in JAVA):

Solution:


import java.util.Scanner;

/**
 *
 * @author Owner
 * Adnan Tavarez & Angelo Liriano 9/25/2012
 * Practica 1 Estructura de datos PUCMM 
 * Dona Gallina
 */
public class Main {

    
    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        String input="";
        
        input=scan.nextLine();
        int[] arrIO = new int[2];
        inputStoI(input, arrIO);
        int  V=arrIO[1];
        int n=arrIO[0];
        
        input=scan.nextLine();
        int[] ai = new int[n];
        inputStoI(input, ai);
        
        input=scan.nextLine();
        int[] bi = new int[n];
        inputStoI(input, bi);
        
        System.out.println(""+calcularSancocho(n, V, ai, bi));   
        
    }
    
    /**
     * Funcion que convierte de un string a un arreglo de enteros
     * siempre que el string tenga solo numeros enteros separados por 
     * espacios
     * @param s string de entrada que se va a convertir
     * @param enteros arreglo de enteros para guardar la salida
     */
    public static void inputStoI(String s, int[] enteros){
        
        String[] strings = s.split(" ");
        
        for(int i =0; i<strings.length;i++){
            enteros[i]= Integer.parseInt(strings[i]);
            //System.out.println("OO"+enteros[i-1]);
        }
    }
    
    
    /**
     * Funcion que calcula el volumen maximo que se puede realizar de sancocho
     * a partir de un volumen de cacerola 
     * @param n numero de ingredientes que lleva la receta
     * @param V volumen maximo que tiene la cacerola 
     * @param ai arreglo de enteros con la relacion entre los ingredientes
     * @param bi arreglo con el volumen maximo de cada ingrediente
     * @return 
     */
    public static double calcularSancocho(int n, int V, int[] ai, int[] bi){
        
        //Definicion de variables
        double x, xMax=bi[0], xMin=0,v=0;
        //int minBusca=bi[0];
        
        //Buscar el minimo disponible para que sea el maximo en la busqueda binaria
        for(int i=0; i<bi.length;i++){
            if(bi[i]<xMax)
                xMax = bi[i];
        }
        
        while(xMax-xMin<-1e-6 || xMax-xMin>1e-6){//mientras sean diferentes 
            
            x=(xMax-xMin)/2+xMin;
            
            v=0;
            for(int i=0;i<ai.length;i++){
                v=v+ ai[i];
                
            }
            v=v*x;
            int cont=0;
            for(int i=0;i<ai.length;i++){
                if(ai[i]*x>bi[i]){
                    //xMax=x;              //si no hay de este producto bajar el maximo 
                    cont++;
                    break;
                }
            }
            if(cont==0){
                if(v>0 && v<=V){
                
                xMin=x;     //si esta dentro del rango subir el minimo lo mas posble
                
                }
                else if(v>V){
                
                xMax=x;     //si me paso del rango bajar el maximo 
                
                }
            }else {
                xMax=x;
            }
            
            
        
        }
        return v;
    }
    
    
    
    
}