import math n = int(input()) print(math.gcd(n, 2019))