P = 31 def toline(k): return k//P,k%P def topoint(v): return v//P,v%P s = input().strip() if s=="send": k = int(input()) a,b = toline(k) res = [] for x in range(P-1): res.append(1+x*P + (a*x+b)%P) print(*res) else: a,b = [int(x) for x in input().split()] x,y = topoint(a-1) x2,y2 = topoint(b-1) # find line through these points: a = ((y2-y)*pow(x2-x,-1,P))%P b = (y-x*a)%P print(a*P+b) # receive 125 187 # there are 31*32 lines through the Z_31^2 plane (I didn't use the vertical lines because they are annoying) # use 30 points of each line # from two points on a line in a field, can recover the line uniquely # so actually with these constraints can even handle 1 <= k <= 992