answer :
w = -1
the picture is the explanation
r = 39/13 = 3
check
117 /39 = 3
true
so r=3
1) n=1
1-4=-3
2) n=2
2-4=-2
3) n=3
3-4=-1