#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
int A, B, K;
while(~scanf("%d %d %d", &A, &B, &K) && A && B){
int tmp = (int)pow(10, K);
if(A % tmp == B % tmp){
printf("-1\n");
}else{
printf("%d\n", A + B);
}
}
return 0;
}
京公网安备 11010502036488号