Dancing Queens

How many moves can the queens make?

Run 5

Input

________
QQ______
_______Q
__QQ____
_____Q__
__Q___Q_
______Q_
____Q___

Expected Output

160