N,A,B = map(int,input().split()) ans = 0 for i in range(N+1): K = int(input()) p = K * (B**(i+1) - A ** (i+1)) // (i+1) ans += p print(int(ans))