class Factorio {
public static void main
(String[] args
) { System.
out.
println(factorio
(3628800)); System.
out.
println(factorio
(479001600)); System.
out.
println(factorio
(6)); System.
out.
println(factorio
(18)); }
private static String factorio
(int i
) { int result = i;
int divisor = 2;
while(result > 1) {
result /= divisor;
divisor++;
}
if(result==1) return (divisor-1)+"!"; else return "NONE";
}
}
Y2xhc3MgRmFjdG9yaW8gewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihmYWN0b3JpbygzNjI4ODAwKSk7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGZhY3RvcmlvKDQ3OTAwMTYwMCkpOwogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihmYWN0b3Jpbyg2KSk7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGZhY3RvcmlvKDE4KSk7CiAgICB9CgogICAgcHJpdmF0ZSBzdGF0aWMgU3RyaW5nIGZhY3RvcmlvKGludCBpKSB7CiAgICAgICAgaW50IHJlc3VsdCA9IGk7CiAgICAgICAgaW50IGRpdmlzb3IgPSAyOwogICAgICAgIHdoaWxlKHJlc3VsdCA+IDEpIHsKICAgICAgICAgICAgcmVzdWx0IC89IGRpdmlzb3I7CiAgICAgICAgICAgIGRpdmlzb3IrKzsKICAgICAgICB9CiAgICAgICAgaWYocmVzdWx0PT0xKSByZXR1cm4gKGRpdmlzb3ItMSkrIiEiOyBlbHNlIHJldHVybiAiTk9ORSI7CiAgICB9Cn0=