Tavas and saddas

mine is not actually an doubt,
i wanna know that this is not an exact bitmasking question, the only part bitmasking is used in this is that exponentation part using right shift, for nine digits number it wouldn’t run more than 2 raise to 9,
so we could also solve this without bitmasking.
considering we know some of gp and combinatorics.

actually constarins are less thats why brute force will work… if we increase the constrains then brute force wont work you have to work on bits… div 2 B Q’s are usually brute forces .