Problem M
Factorial! You Must be Kidding!!!
Input: standard input
Output: standard output
Time Limit: 1 second
Memory Limit: 32 MB
Arif
has bought a super computer from Bongobazar. Bongobazar is a place in
Factorial (0) = 1
Factorial (n) = n*factorial
(n-1).
Of
course one can manipulate these expressions. For example, it can be written as
Factorial (n) =n*(n-1)*factorial
(n-2)
This
definition can also be converted to an iterative one.
But
Arif knows that his program will not behave rightly in the super computer. You
are to write program which will simulate that changed behavior in a Normal
Computer.
Input
The
input file contains several lines of input. Each line contains a single integer
n. No integer has more than six
digits. Input is terminated by end of file.
Output
For
each line of input you should output a single line. This line will contain a
single integer n! if the value of n! fits within the unsigned long
integer of Arif’s computer. Otherwise the line will contain one of the
following two words
Overflow! //(When n! > 6227020800)
Underflow! //(When n! < 10000)
Sample Input
2
10
100
Sample Output
Underflow!
3628800
Overflow!
(The Decider Contest, Problem setter: Shahriar Manzoor)