while True:
try:
month = int(input())
big_rabbit = 0 #大兔子数目
small_rabbit_1 = 1 #刚生下来的小兔子数目
small_rabbit_2 = 0 #快长大的小兔子数目
rabbit_num = []
for i in range(31):
if(i == 0): #第一个月,刚买回来一只小兔子
big_rabbit = 0
small_rabbit_1 = 1
small_rabbit_2 = 0
rabbit_num.append(small_rabbit_1 + small_rabbit_2 + big_rabbit)
else: #后面的每个月
big_rabbit += small_rabbit_2 #中兔子变大兔子
small_rabbit_2 = 0 #中兔子没了
small_rabbit_2 = small_rabbit_1 #小兔子变中兔子
small_rabbit_1 = 0
small_rabbit_1 = big_rabbit #大兔子生小兔子
rabbit_num.append(small_rabbit_1 + small_rabbit_2 + big_rabbit) #每个月总数
print(rabbit_num[month - 1]) #输出需要的某个月的兔子总数
except:
break