Dancing Queens

How many moves can the queens make?

Run 1

Input

Q_______
________
________
________
________
________
________
________

Expected Output

21