#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define MD 998244353ul

unsigned a[][2]={
{        0,        1},
{        1,        1},
{        2,        3},
{       13,       21},
{      610,      987},
{  1346269,  2178309},
{  3164985,868874039},
{268416577, 68921677},
{ 73226039,341969642},
{394135662,104186878},
{492539709,245887711},
{700918724,942839953},
{492450285,188323242},
{310045918, 57949216},
{410017171,490320229},
{869685535,688849975},
{752861792,539562357},
{432433814,123638574},
{  3824821,360202863},
{472156872,494782135},
{ 58989191, 70085358},
{801989325,572234585},
{713664768,618697614},
{173605931,121911603},
{849821511,463493561},
{319107674,994942111},
{ 28542621,845731073},
{295681022,778816073},
{117335797,650103746},
{170833367,658742853},
{759024845,961232082},
{821475450,901056802},
{738819114,806212005},
{557220631,498764237},
{746648672,982428304},
{633343556,474738840},
{235955861, 24695414},
{251954951,797269393},
{579769006,267226822},
{460957071,820525996},
{721762697,381746629},
{512280016, 87518178},
{365690101,209461837},
{588711366,548106755},
{366750805,990012936},
{   121997,953351725},
{420032222,713838745},
{770879409,680616443},
{770256962,160433130},
{311807562,892457479},
{335533397,673858075},
{313827235,262902563},
{303375602,550714785},
{522866582,936139088},
{603459412,255407995},
{382955669,635166915},
{322964226,283451749},
{ 33545516,759538387},
{604456116, 62574976},
{313370250,229945172},
};

typedef unsigned long ulong;

main(){
	ulong n,x0=1,x1=0,y0=0,y1=1;
	scanf("%lu",&n);
	for(n+=2;n;){
		ulong z=__builtin_ctzl(n);
		n-=1ul<<z;
		ulong y0=a[z][0];
		ulong y1=a[z][1];
		ulong t0=x0*y0+x1*y1;
		ulong t1=(x0+x1)*(y0+y1)-x0*y0;
		x0=t0%MD;
		x1=t1%MD;
	}
	printf("%d",(x0+MD-1)%MD);
}