import sys; input = sys.stdin.readline while True: S, x, y, dx, dy = map(int, input().split()); t = 0 if S < 1: break while True: m = x%(2*S); n = y%(2*S) if (S