x = int(raw_input())
y = int(raw_input())

print % (x + y)
print % (x - y)
print % (x * y)
print % (x / y)     
                                   
print % (x% y)    
print % divmod(x, y)
print % x**y


raw_input( )