import numpy as np import math N=input() n1=int(N) n=n1%6 x=pow(10,n) x1=2*x a=np.floor(x1/7) y=a%10 y1=int(y) print(y1)