A Trivial Problem

Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks for the number of positive integers n, such that the factorial of n ends with exactly m zeroes. Are you among those great programmers who can solve this problem?

Input

The only line of input contains an integer m (1 ≤ m ≤ 100 000) — the required number of trailing zeroes in factorial.

Output

First print k — the number of values of n such that the factorial of n ends with mzeroes. Then print these k integers in increasing order.

Examples

Input
1
Output
5
5 6 7 8 9
Input
5
Output
0

Note

The factorial of n is equal to the product of all integers from 1 to n inclusive, that is n! = 1·2·3·...·n.

In the first sample, 5! = 120, 6! = 720, 7! = 5040, 8! = 40320 and 9! = 362880.

题目给出后缀0个数,输出n!满足条件的所有n值。

数论题。由于因子里含有偶数,所以非零末尾一定是偶数。产生0的因数一定包含5,所以题目就转化为寻找阶乘因子中含有5的个数。

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<set>
#include<algorithm>
#define MAX 1005
#define INF 0x3f3f3f3f
using namespace std; int a[MAX]; int main()
{
int n,c,i,j;
scanf("%d",&n);
c=;
for(i=;i<=;i++){ //注意这里是枚举阶乘的因子,需要大于后缀0最长的情况
int ii=i;
while(ii%==&&ii>){
c++;
ii/=;
}
if(c==n){
printf("5\n");
printf("%d",i);
for(j=i+;j<=i+;j++){
printf(" %d",j);
}
break;
}
else if(c>n){
printf("0\n");
break;
}
}
return ;
}

最新文章

  1. python黑魔法 -- 内置方法使用
  2. python 静态方法、类方法(二)
  3. 安装dubbo-admin遇到的问题和解决之道
  4. 电商CRM的痛点在哪里?
  5. C library function - rewind()
  6. 用eclipse加载别人的工程,报错Target runtime com.genuitec.runtime.generic.jee60 is not defined
  7. 20步打造最安全的NGINX WEB服务器
  8. C语言每日一题之No.6
  9. Spring学习之基本概念
  10. HDU-4405 Aeroplane chess
  11. 【转】JavaScript对Json节点的增删改
  12. linux下查阅文件内容cat,more,less,tail
  13. CSharp设计模式读书笔记(9):组合模式(学习难度:★★★☆☆,使用频率:★★★★☆)
  14. enode框架step by step之saga的思想与实现
  15. echarts图表里label文字过长换行的方法
  16. web.config中的configSource
  17. Linux系统如何添加IP别名
  18. JS图片水印
  19. CentOS7配置crate集群
  20. Mybatis 接口绑定

热门文章

  1. struts2中拦截器与过滤器之间的区别
  2. SQL Server 中 GO 的用法(转)
  3. Java线程池的配置
  4. 关于引用WebLogic.jar时遇到NoClassDefFoundError问题的解决方法
  5. JS 中的面向对象
  6. css浏览器兼容问题集锦
  7. &lt;ReversingEngineering&gt;关于windows32位系统下的dll注入技术经验汇
  8. 对于glut和freeglut的一点比较和在VS2013上的配置问题
  9. Download rtsp.c
  10. Web性能测试中的几个概念【转】