CF40D.Interesting Sequence

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Berland scientists noticed long ago that the world around them depends on Berland population. Due to persistent research in this area the scientists managed to find out that the Berland chronology starts from the moment when the first two people came to that land (it is considered to have happened in the first year). After one Berland year after the start of the chronology the population had already equaled 13 people (the second year). However, tracing the population number during the following years was an ultimately difficult task, still it was found out that if did_{i} — the number of people in Berland in the year of ii , then either di=12di2d_{i}=12d_{i-2} , or di=13di112di2d_{i}=13d_{i-1}-12d_{i-2} . Of course no one knows how many people are living in Berland at the moment, but now we can tell if there could possibly be a year in which the country population equaled AA . That's what we ask you to determine. Also, if possible, you have to find out in which years it could be (from the beginning of Berland chronology). Let's suppose that it could be in the years of a1,a2,...,aka_{1},a_{2},...,a_{k} . Then you have to define how many residents could be in the country during those years apart from the AA variant. Look at the examples for further explanation.

输入格式

The first line contains integer AA ( 1<=A<10^{300} ). It is guaranteed that the number doesn't contain leading zeros.

输出格式

On the first output line print YES, if there could be a year in which the total population of the country equaled AA , otherwise print NO.

If the answer is YES, then you also have to print number kk — the number of years in which the population could equal AA . On the next line you have to output precisely kk space-separated numbers — a1,a2,...,aka_{1},a_{2},...,a_{k} . Those numbers have to be output in the increasing order.

On the next line you should output number pp — how many variants of the number of people could be in the years of a1,a2,...,aka_{1},a_{2},...,a_{k} , apart from the AA variant. On each of the next pp lines you have to print one number — the sought number of residents. Those number also have to go in the increasing order.

If any number (or both of them) kk or pp exceeds 10001000 , then you have to print 10001000 instead of it and only the first 10001000 possible answers in the increasing order.

The numbers should have no leading zeros.

输入输出样例

  • 输入#1

    2
    

    输出#1

    YES
    1
    1
    0
    
  • 输入#2

    3
    

    输出#2

    NO
    
  • 输入#3

    13
    

    输出#3

    YES
    1
    2
    0
    
  • 输入#4

    1729
    

    输出#4

    YES
    1
    4
    1
    156
    
首页