srm616 div1 500 math, permutation