#include #include using namespace std; using isize = size_t; using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; using i128 = __int128_t; using u128 = __uint128_t; using f64 = long double; using p2 = pair; using el = tuple; using mint = atcoder::modint998244353; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(18); _main(); } void _main() { i64 n, a, b; cin >> n >> a >> b; vector k(n + 1); i64 x = 0, y = 1; for (i64 i = 0; i <= n; i++) { cin >> k[i]; // k[i] / (i + 1) * t^(i + 1) i64 u = 1, v = 1; for (i64 j = 0; j < i + 1; j++) u *= a, v *= b; x *= i + 1, y *= i + 1; x += y / (i + 1) * (v - u) * k[i]; } if (x < 0) { cout << -(-x / y) << "\n"; return; } cout << x / y << "\n"; }