Grand Temple - Unable To Understand The Example Test Case

I am unable to understand the example test case. According to my calculation I am getting 6 as the answer of the example test case. Please help me to understand the problem.