I=input N,A,B=map(int,I().split()) D=27720 print(sum((B**i-A**i)*D//i*int(I())for i in range(1,N+2))//D)