#轉字串後取後 m 位
def Say_Good_Bye(value):
ctr = -1 if value<0 else 1
value = [i for i in str(abs(value))]
value = "0"*(limit-len(value))+"".join(value) if len(value)<=limit else "".join(value[len(value)-limit:len(value)])
return int(value)*ctr
inf = [int(i) for i in input().split()]
limit = inf[2]
result = 0
c = 1
while c<=inf[0] :
var = [int(i) for i in input().split()]
result += Say_Good_Bye(Say_Good_Bye(var[0])*(Say_Good_Bye(inf[1])**var[1]))
result = Say_Good_Bye(result)
c += 1
result = [i for i in str(abs(result))]
print( "0"*(limit-len(result))+"".join(result) if len(result)<=limit else "".join(value[len(result)-limit:len(result)]) )