http://acm.hdu.edu.cn/showproblem.php?pid=1877
/*
2011-10-9
author:BearFly1990
*/
package acm.hdu.tests;
import java.io.BufferedInputStream;
import java.util.Scanner;
public class HDU_1877 {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
Integer m = null;
Integer a = null;
Integer b = null;
while(in.hasNext()){
m = in.nextInt();
if(m == 0){
break;
}
a = in.nextInt();
b = in.nextInt();
System.out.println(Integer.toString(a+b,m));
}
}
}