yasi04

kod 55

Oct 27th, 2021
654
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. x = int(input())
  2. y = int(input())
  3. if x == y == 1:
  4.     print(1)
  5. elif x == y:
  6.     print(-1)
  7. else:
  8.     k = 1
  9.     while True:
  10.         left = y * k
  11.         right = x * (k + 1)
  12.         #print(left, right)
  13.         if right - left == 1 or right - left == 0:
  14.             print(x * k)
  15.             break
  16.         k += 1
RAW Paste Data