You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 4 година
1234567891011121314151617181920
  1. import itertools
  2. import sys
  3. text = sys.stdin.read()
  4. A, B = map(int, text.splitlines())
  5. val = 1
  6. subj = 7
  7. for i in itertools.count():
  8. val = (val * subj) % 20201227
  9. if val == A:
  10. loopA = i + 1
  11. break
  12. val = 1
  13. subj = B
  14. for _ in range(loopA):
  15. val = (val * subj) % 20201227
  16. print(val)