#5257

BÀI TẬP :   90

  1. import sys
  2. def LuyThua(x,n):
  3.     kq=1
  4.     for i in range(1,n+1):
  5.         kq*=x
  6.     return kq
  7. k,x=map(int,input().split())
  8. s=0
  9. for i in range(0,k):
  10.     a,n=map(int,input().split())
  11.     s+=a*LuyThua(x,n)
  12. print(s)