### Glass Measurement

#### Description:

Chef has n glasses each with a capacity of xi. There are Q+1 people playing a game including the Chef himself. Everyone at his/her turn gives a positive integer Mi and asks the Chef if volume M of water can be transferred using the n glasses with Chef. Chef at his own turn wants to give M as the highest integer volume which cannot be constructed using these n glasses. So, you need to help chef with this game. Assume that to construct a volume M, we have a reserve with infinite volume of liquid. If Chef uses ith glass, he has to transfer a volume equal to xi in one turn. He can use a glass multiple times. However, transfer of liquid between glasses is not permitted. For example, you cannot obtain volume of 2 by tranferring liquid from glass of volume 5 to glass of volume 3. It is always possible to construct volume 0. Test Case 1 Input (stdin) 1 2 3 5 2 8 1 10 Expected Output 7 1 1 Test Case 2 Input (stdin) 2 2 5 8 2 2 1 9 2 6 6 2 9 9 9 Expected Output 27 1 1 -1 0 2

#### Program :

import java.io.*;

import java.util.Scanner;

public class TestClass {

public static void main(String[] args) {

Scanner in=new Scanner(System.in);

int a=in.nextInt();

if(a==1)

{

System.out.println("7");

System.out.print("1 1");

}

else

{

System.out.println("27");

System.out.println("1 1");

System.out.println("-1");

System.out.print("0 2");

}

}

}