import random
def getPos(n,p):
pos = n+p
maxNum=39
pos=pos if pos<=maxNum else pos-maxNum-1
return pos
manPosition=38
dice=random.randint(1,6)
print(dice,manPosition)
print(getPos(dice,manPosition))
aW1wb3J0IHJhbmRvbQoKZGVmIGdldFBvcyhuLHApOgoJcG9zID0gbitwCgltYXhOdW09MzkKCXBvcz1wb3MgaWYgcG9zPD1tYXhOdW0gZWxzZSBwb3MtbWF4TnVtLTEKCXJldHVybiBwb3MKCm1hblBvc2l0aW9uPTM4CmRpY2U9cmFuZG9tLnJhbmRpbnQoMSw2KQpwcmludChkaWNlLG1hblBvc2l0aW9uKQpwcmludChnZXRQb3MoZGljZSxtYW5Qb3NpdGlvbikp