Problem in MARBLES (mathematics)

What is wrong with this python code that it is giving wrong answer…

for division operation use // instead of / … in python 3 both have different meaning.