an expedition group fly planet ACM1 Earth order study bipedal specie representative do not antennas headsthe fly saucer brave pioneer set consist section these section connect chain 1st section adjacent 2nd 2nd 1st 3rd one 3rd 2nd the transition possible adjacent sectionsthe spacecraft team consist n alien each give rank integer 1 n the rank astronaut distinct the rule establish Saucer state alien section section b senior rank alien segment b segment b course require adjacent any alien require exactly 1 minute besides safety regulation require alien move minute shipAlien a senior rank alien b number indicate rank a corresponding number bat moment saucer team 3rd segment they need 1st segment one member crew alien identification number CFR140 decide calculate minimum time minute need perform taskhelp cfr140 figure minimum time minute astronaut need 3rd segment 1st since number large count modulo m