you ant task add n new room number 0 n1 colony you give expansion plan 0indexe integer array length n prevroom prevRoomi indicate build room prevRoomi building room room connect directly Room 0 build prevroom0 1 the expansion plan give room build room reachable room 0you build room time travel freely room build connect you choose build room long previous room builtreturn number different order build room since answer large return modulo 109 7 Example 1input prevroom 101output 1explanation there way build additional room 0 1 2example 2input prevroom 10012output 6explanationthe 6 way are0 1 3 2 40 2 4 1 30 1 2 3 40 1 2 4 30 2 1 3 40 2 1 4 3 Constraintsn prevroomlength2 n 105prevRoom0 10 prevRoomi n 1 nEvery room reachable room 0 room build