I recommend you to replace line 5 with "B=(B+1)MOD 120". It'll make line 8 unnecessary.