This page is still under construction.

Parts of this page are still being built. What you see may change.

Factorial Digit Count

Time limit1sMemory limit128 MB

Summary
Given N, list every positive integer X for which X! has exactly N decimal digits, or report that none exists.
Level

Medium6 of 10

Topics
Math, Binary search, Number theory, Implementation
Solved
No attempts yet

Problem

Given a positive integer NN, find every positive integer XX such that 1×2×3×⋯×X1 \times 2 \times 3 \times \cdots \times X (that is, X!X!) has exactly NN decimal digits. Such an XX may not exist. You may assume 1≤N≤1500001 \le N \le 150000.

Input

The first line of input contains a single positive integer NN.

Output

If no such XX exists, print the string NO on the first line. Otherwise, print on the first line how many values of XX satisfy the condition, then print all such XX in increasing order, one per line.

Examples4

  1. Example 1

    Input
    5
    
    Expected output
    1
    8
    
  2. Example 2

    Input
    1
    
    Expected output
    3
    1
    2
    3
    
  3. Example 3

    Input
    2
    
    Expected output
    1
    4
    
  4. Example 4

    Input
    3
    
    Expected output
    2
    5
    6