Dancing Queens

How many moves can the queens make?

Run 5

Input

____Q___
______Q_
_____Q_Q
________
________
_Q______
_______Q
________

Expected Output

111