#include"bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using pii = pair; using pll = pair; #define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++) #define REP(i,n) FOR((i),0,(n)) #define WAITING(str) int str;std::cin>>str; #define DEBUGING(str) cout<< #str << " " str< nowv, nextv; using namespace chrono; int main() { auto start = system_clock::now(); cin >> N >> p >> q; nowv = vector(N + 2); nextv = vector(N + 2); nowv[1] = 1; REP(i, 1e9) { fill(nextv.begin(), nextv.end(), 0); FOR(j, 1, N) { nextv[j - 1] += p * nowv[j]; nextv[j + 1] += q * nowv[j]; dead += (1 - p - q)*nowv[j]; } FOR(j, 1, N + 1)nowv[j] = nextv[j]; nowv[0] += nextv[0]; nowv[N + 1] += nextv[N + 1]; if (i % 1000 == 0) { auto now = system_clock::now(); auto dur = duration_cast(now - start).count(); //cerr << dur << endl; if (dur > 1800) { break; } } } cout << nowv.front(); //cout << "back: " << nowv.front() << " go:" << nowv.back() << " dead:" << dead << endl; return 0; }