title: Getting NZEC in Java Code
body: <p>I'm trying to solve the problem <a href="http://www.codechef.com/APRIL12/problems/DUMPLING/" rel="nofollow">http://www.codechef.com/APRIL12/problems/DUMPLING/</a></p>
  
  <p>I'm getting runtime error NZEC on codechef. I searched on the Internet but did not manage to make my code succeed.</p>
  
  <p>This is my code :</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.math.BigInteger;
  
  public class Main {
  
      public BigInteger gcd(BigInteger a,BigInteger b){
          if(b.compareTo(BigInteger.valueOf(0)) == 0)
              return a;
          return gcd(b,a.mod(b));
      }
  
      public static void main(String[] args) {
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          String str;
          int t = 1;
          Main obj = new Main();
          try{
              str = br.readLine();
              t = Integer.parseInt(str);
          }
          catch(IOException e){
              System.out.println("error");
          }
  
          for(int w = 0; w &lt; t; w++){
              BigInteger a = BigInteger.valueOf(1);
              BigInteger b = BigInteger.valueOf(1);
              BigInteger c = BigInteger.valueOf(1);
              BigInteger d = BigInteger.valueOf(1);
              BigInteger k = BigInteger.valueOf(1);
              try{
                  str = br.readLine();
                  String s[] = str.split(" ");
                  a = new BigInteger(s[0]);
                  b = new BigInteger(s[1]);
                  c = new BigInteger(s[2]);
                  d = new BigInteger(s[3]);
                  k = new BigInteger(s[4]);
              }
              catch(IOException e){
                  System.out.println("error");
              }
  
              BigInteger g1,g2,num;
              if(a.compareTo(b) &lt; 0){
                  num = a;
                  a = b;
                  b = num;
              }
  
              if(c.compareTo(d) &lt; 0){
                  num = c;
                  c = d;
                  d = num;
              }
  
              g1 = obj.gcd(a,b);
              g2 = obj.gcd(c,d);
  
              if(g1.compareTo(g2) &lt; 0){
                  num = g1;
                  g1 = g2;
                  g2 = num;
              }
              BigInteger g3 = obj.gcd(g1,g2);
  
              BigInteger l = g1.divide(g3);
              l = l.multiply(g2);
  
              BigInteger res = k.divide(l);
              BigInteger fin = res.multiply(BigInteger.valueOf(2));
              fin = fin.add(BigInteger.valueOf(1));
              System.out.println(fin);
          }
      }
  
  }
  </code></pre>
  
  <p>can anyone please tell me where am I doing wrong?</p>