#if __INCLUDE_LEVEL__ == 0 #include __BASE_FILE__ void Solve() { using ld = long double; #define double ld fesetround(FE_UPWARD); int n; double A, B; IN(n, A, B); double pA = 1; double pB = 1; double C = 1; vector v; for (int i : Rep1(0, n)) { double K; IN(K); C /= i + 1; pA *= A; pB *= B; v.push_back(K * C * pB); v.push_back(K * C * -pA); } double ans = 0; ranges::stable_sort(v, {}, LAMBDA(x, abs(x))); for (double e : v) { ans += e; } OUT(floor(ans)); #undef double } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); Solve(); } #elif __INCLUDE_LEVEL__ == 1 #include template concept MyRange = std::ranges::range && !std::convertible_to; template concept MyTuple = std::__is_tuple_like::value && !MyRange; namespace std { istream& operator>>(istream& is, MyRange auto&& r) { for (auto&& e : r) is >> e; return is; } istream& operator>>(istream& is, MyTuple auto&& t) { apply([&](auto&... xs) { (is >> ... >> xs); }, t); return is; } ostream& operator<<(ostream& os, MyRange auto&& r) { auto sep = ""; for (auto&& e : r) os << exchange(sep, " ") << e; return os; } ostream& operator<<(ostream& os, MyTuple auto&& t) { auto sep = ""; apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t); return os; } } // namespace std using namespace std; #define LAMBDA(x, ...) ([&](auto&& x) -> decltype(auto) { return __VA_ARGS__; }) #define Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__) #define Rep1(...) [](int l, int r) { return Rep(l, r + 1); }(__VA_ARGS__) #define IN(...) (cin >> forward_as_tuple(__VA_ARGS__)) #define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n') #endif // __INCLUDE_LEVEL__ == 1