n,a,b=map(int,input().split()) f=0 for i in range(n+1): k=int(input()) s=b**(i+1)*k//(i+1) t=a**(i+1)*k//(i+1) f=f+s-t print(int(f))