n = int(input())
h, w = map(int, input().split())
total = h * w
ans = total % n
print(ans)

61cab24bdc8b559ce931d799b63e9256fea7ced0
<mask token>

<mask token>
print(ans)

n = int(input())
h, w = map(int, input().split())
total = h * w
ans = total % n
print(ans)
