import sys input = sys.stdin.readline mod=int(input()) now=1 ANS=1 for i in range(1,mod): now=now*i%mod ANS+=pow(now,mod-2,mod) ANS%=mod print(ANS)