R=range N=int(input()) D=[1] for i in R(1,N//3+1):D+=[sum(D[j]*sum(D[k]*D[i-1-j-k]for k in R(i-j))for j in R(i))%998244353] print(0if N%3 else D[-1])