def reaminder(A,B,C):
print((A+B)%C)
print(((A%C) + (B%C))%C)
print((A*B)%C)
print(((A%C) * (B%C))%C)
A,B,C = map(int,input().split(" "))
reaminder(A,B,C)
def count_chess(get_list):
all_list = [1, 1, 2, 2, 2, 8]
check_list = []
for idx, num in enumerate(get_list):
count = all_list[idx]- num
check_list.append(count)
print(check_list)
get_list = list(map(int,input().split(' ')))
count_chess(get_list)