Any questions do not hesitate to contact.
#include <bits/stdc++.h>
using namespace std;
//https://oeis.org/A005179
//https://link.springer.com/article/10.1007/s11139-014-9572-9
int main() {
long long int n;
string res[] = {"+INF","1","2","4","6","16","12","64","24","36","48","1024","60","4096","192","144","120","65536","180","262144","240","576","3072","4194304","360","1296","12288","900","960","268435456","720","+INF","840","9216","196608","5184","1260","+INF","786432","36864","1680","+INF","2880","+INF","15360","3600","12582912","+INF","2520","46656","6480","589824","61440","+INF","6300","82944","6720","2359296","805306368","+INF","5040","+INF","+INF","14400","7560","331776","46080","+INF","983040","37748736","25920","+INF","10080","+INF","+INF","32400","3932160","746496","184320","+INF","15120","44100","+INF","+INF","20160","5308416","+INF","+INF","107520","+INF","25200","2985984","62914560","+INF","+INF","21233664","27720","+INF","233280","230400","45360","+INF","2949120","+INF","430080","129600","+INF","+INF","50400","+INF","414720","+INF","60480","+INF","11796480","339738624","+INF","921600","+INF","47775744","55440","60466176","+INF","+INF","+INF","810000","100800","+INF","83160","+INF","1658880","+INF","322560","191102976","+INF","176400","6881280","+INF","188743680","+INF","181440","+INF","+INF","241864704","110880","+INF","+INF","1166400","+INF","+INF","226800","+INF","27525120","14745600","3732480","+INF","1290240","+INF","+INF","+INF","166320","+INF","352800","+INF","+INF","2073600","+INF","+INF","221760","+INF","26542080","58982400","+INF","+INF","+INF","3240000","967680","+INF","+INF","+INF","277200","+INF","14929920","+INF","440401920","+INF","+INF","+INF","+INF","705600","106168320","+INF","332640","+INF","+INF","8294400","1632960","+INF","1612800","+INF","498960","+INF","+INF","+INF","20643840","+INF","+INF","943718400","3870720","+INF","907200","+INF","+INF","+INF","+INF","+INF","554400","+INF","+INF","+INF","2903040","+INF","+INF","+INF","665280","1587600","+INF","+INF","82575360","+INF","+INF","18662400","+INF","+INF","6451200","+INF","+INF","+INF","238878720","+INF","720720","+INF","302330880","2822400","+INF","29160000","+INF","+INF","+INF","+INF","5670000","+INF","1108800","+INF","+INF","132710400","1081080","+INF","+INF","+INF","11612160","+INF","+INF","+INF","3548160","+INF","955514880","+INF","+INF","+INF","1940400","+INF","61931520","74649600","+INF","51840000","+INF","+INF","+INF","+INF","1995840","+INF","+INF","+INF","+INF","530841600","+INF","+INF","1441440","+INF","+INF","+INF","+INF","+INF","8164800","+INF","+INF","11289600","+INF","+INF","2494800","+INF","+INF","+INF","247726080","+INF","103219200","+INF","26127360","+INF","+INF","+INF","14192640","+INF","+INF","6350400","+INF","+INF","+INF","+INF","2162160","+INF","+INF","+INF","3880800","207360000","+INF","+INF","+INF","+INF","14515200","+INF","+INF","+INF","+INF","+INF","2882880","+INF","+INF","+INF","185794560","+INF","412876800","729000000","+INF","+INF","+INF","+INF","+INF","+INF","22680000","45158400","10644480","+INF","+INF","+INF","+INF","+INF","+INF","+INF","3603600","+INF","+INF","+INF","104509440","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","39690000","+INF","+INF","7761600","+INF","743178240","+INF","+INF","+INF","4324320","466560000","+INF","+INF","+INF","+INF","58060800","+INF","17962560","+INF","+INF","+INF","17740800","+INF","+INF","+INF","6486480","+INF","+INF","+INF","+INF","21344400","+INF","+INF","227082240","+INF","+INF","+INF","+INF","+INF","+INF","+INF","42577920","+INF","+INF","+INF","9979200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","7207200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","31933440","57153600","+INF","+INF","+INF","+INF","+INF","+INF","8648640","+INF","17463600","+INF","+INF","+INF","+INF","+INF","908328960","+INF","+INF","722534400","+INF","+INF","130636800","+INF","+INF","+INF","+INF","+INF","70963200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","10810800","+INF","+INF","+INF","+INF","+INF","31046400","+INF","+INF","+INF","204120000","+INF","+INF","+INF","+INF","101606400","+INF","+INF","+INF","+INF","62370000","+INF","+INF","+INF","14414400","+INF","+INF","+INF","+INF","+INF","928972800","+INF","17297280","+INF","+INF","+INF","+INF","+INF","+INF","+INF","127733760","+INF","+INF","+INF","+INF","158760000","+INF","+INF","46126080","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","25225200","+INF","+INF","+INF","681246720","+INF","522547200","+INF","+INF","+INF","362880000","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","25945920","+INF","+INF","+INF","+INF","+INF","+INF","85377600","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","21621600","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","406425600","+INF","+INF","89812800","+INF","+INF","+INF","+INF","+INF","124185600","+INF","+INF","+INF","+INF","+INF","32432400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","287400960","+INF","+INF","+INF","+INF","+INF","+INF","+INF","184504320","+INF","+INF","+INF","+INF","+INF","69854400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","36756720","+INF","+INF","+INF","+INF","+INF","+INF","+INF","50450400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","159667200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","43243200","+INF","+INF","192099600","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","914457600","+INF","+INF","+INF","+INF","+INF","+INF","249480000","+INF","496742400","+INF","138378240","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","61261200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","341510400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","436590000","+INF","+INF","+INF","+INF","+INF","100900800","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","73513440","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","638668800","+INF","+INF","+INF","233513280","+INF","+INF","+INF","+INF","+INF","+INF","+INF","230630400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","110270160","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","277477200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","553512960","+INF","+INF","+INF","+INF","+INF","+INF","+INF","129729600","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","122522400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","415134720","+INF","628689600","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","147026880","+INF","+INF","+INF","227026800","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","922521600","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","768398400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","183783600","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","403603200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","810810000","+INF","+INF","+INF","+INF","+INF","+INF","+INF","245044800","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","294053760","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","691891200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","428828400","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","441080640","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","367567200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","551350800","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","908107200","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","698377680","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","857656800","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","+INF","735134400"};
while(scanf("%lld",&n)==1 && n!=0){
if (n > 1344) printf("+INF\n");
else cout<<res[n]<<'\n';
}
return 0;
}
Keep in touch with Isaac Lozano Osorio!