$/=get.words;say +($0,*-($3>($++%12+1-$2)>=0)*$1-$1...^0>=*)