import java.io.*; import java.util.*; import java.awt.*; import java.text.*; import java.math.*; /** * Solution to Knitting */ class knitting { public Scanner sc; public PrintStream ps; public String toString() { return "knitting"; } /** * The main method */ public void doit() throws Exception { sc = new Scanner( System.in ); // new Scanner( new File( "knitting.judge" ) ); ps = System.out; // new PrintStream( new FileOutputStream( "knitting.solution" ) ); for(;;) { // Read n, m, k int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); // Exit if at the end if( n==0 && m==0 && k==0 ) break; // Read in an array of the differences int diffs[] = new int[k]; for( int i=0; i