代码:
package Test1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
public class Test42_1015 {
/**
* by qr jobdu 1015 2014-8-23
* @throws IOException
*/
public static void main(String[] args) throws IOException {
StreamTokenizer st = new StreamTokenizer(new BufferedReader(
new InputStreamReader(System.in)));
while(true){
st.nextToken();
int A=(int)st.nval;
st.nextToken();
int B=(int)st.nval;
st.nextToken();
int K=(int)st.nval;
if(A==0 && B==0)
break;
int chushu=(int)Math.pow(10, K);
int A1=A%chushu;
int B1=B%chushu;
if(A1==B1)
System.out.println("-1");
else
System.out.println(A+B);
}
}
}