The expression N!, read as "N factorial," denotes the product of the first N positive integers, where N is nonnegative. So, for example, 
N N! 
0 1 
1 1 
2 2 
3 6 
4 24 
5 120 
10 3628800

For this problem, you are to write a program that can compute the last non-zero digit of the factorial for N. For example, if your program is asked to compute the last nonzero digit of 5!, your program should produce "2" because 5! = 120, and 2 is the last nonzero digit of 120.

InputInput to the program is a series of nonnegative integers, each on its own line with no other letters, digits or spaces. For each integer N, you should read the value and compute the last nonzero digit of N!. 
OutputFor each integer input, the program should print exactly one line of output containing the single last non-zero digit of N!. 
Sample Input

1
2
26
125
3125
9999

Sample Output

1
2
4
8
2
8

最新文章

  1. 解决VirtualBox只能安装32位系统的问题
  2. 用php获取本周,上周,本月,上月,本季度日期的代码
  3. AS3从入门到放弃
  4. Less里css表达式的写法
  5. OPENSSL安装 以及使用openssl中的AES加密和解密
  6. Ubuntu下安装Nginx,PHP5(及PHP-FPM),MySQL
  7. 转:栈和队列小知识【STL用法】
  8. [python] 视频008
  9. 值得关注的 10 个 Python 英文博客
  10. Delphi 线程resume 不能调用Execute
  11. Histats申请Counter网站计数器 - Blog透视镜
  12. JS判断当前使用设备是pc端还是web端(转MirageFireFox)
  13. __x__(44)0910第六天__表单
  14. CentOS 使用firewalld打开防火墙与端口
  15. WiFi-ESP8266入门http(2-1)文件系统-复杂结构的网页
  16. 初始Redis
  17. web安全之机器学习入门——1.环境搭建
  18. 简单理解jQuery中$.getJSON、$.get、$.post、$.ajax用法
  19. 在 Roslyn 分析语法树时添加条件编译符号的支持
  20. 精《Linux内核精髓:精通Linux内核必会的75个绝技》一HACK #4 如何使用Git

热门文章

  1. hdu 1695 GCD (欧拉函数+容斥原理)
  2. [NOIP2016]愤怒的小鸟 DP
  3. nowcoder 提高组模拟赛 最长路 解题报告
  4. python3初识selenium
  5. python 一些乱七八糟的东西
  6. css3中-moz、-ms、-webkit分别代表的意思
  7. GTK+与MFC不完全对比
  8. CSS3学习笔记之loading动画
  9. uva 11427
  10. 动态规划:数位DP