#Lutece2242. 如果早知道wf题也会被ak - 年度版

如果早知道wf题也会被ak - 年度版

Migrated from Lutece 2242 如果早知道wf题也会被ak - 年度版

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

预购特典:世界名画《阿伟在232》

Snipaste2019-05-1310-45-50

定义数列A由以下规则生成:
A[i]=(A[i-1]+A[i-2]+A[i-3])%p
A[1]=1
A[2]=1
A[3]=2
给出A的某个连续段A[i-1],A[i],A[i+1],求最小的满足条件的i

Input

第一行有三个整数A[i-1], A[i], A[i+1]

Output

输出一行,包含一个整数,表示最小的满足条件的i

Samples

1 1 2
2
4 7 13
5

Constraints

p=109+710^9+7

Note

保证有解

Resources

2019 UESTC ACM Training for math and geometry