#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, a, b; cin >> n >> a >> b; ll lc = 1; for(int i = 1; i <= 11; i++) lc = lcm(lc, i); __int128 am = 1, bm = 1, ans = 0; ll v; for(int i = 0; i <= n; i++){ cin >> v; am *= a, bm *= b; ans += (v * (bm - am)) * lc / (i + 1); } cout << (ll)(ans / lc) << '\n'; }