Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n, k = map(int, input().split())
- a, b, c = map(int, input().split())
- k = k % n
- s = n
- s = min(s, abs(a - k))
- s = min(s, k + n - a)
- s = min(s, abs(b - k))
- s = min(s, k + n - b)
- s = min(s, abs(c - k))
- s = min(s, k + n - c)
- print(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement