#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b MA[3]; int main(){ std::ifstream in("text.txt"); std::cin.rdbuf(in.rdbuf()); cin.tie(0); ios::sync_with_stdio(false); int N,A,B;cin>>N>>A>>B; string S;cin>>S; vector X; int i=0; while(i+2B){ swap(A,B); sw=true; } int left=0,right=N+1; while(right-left>1){ int mid=(left+right)/2; int taA,taB; taA=(mid+1)/2; taB=mid/2; if(sw) swap(taA,taB); priority_queue> PQ; for(int x:X) PQ.push(mp(x%A,x)); int cn=0; while(!PQ.empty()){ if(cn==taB) break; auto u=PQ.top();PQ.pop(); int x=u.se; if(x>=B){ x-=B; cn++; PQ.push(mp(x%A,x)); } } if(cn==taB){ int can=0; while(!PQ.empty()){ auto u=PQ.top();PQ.pop(); int x=u.se; can+=x/A; } if(can>=taA){ left=mid; }else{ right=mid; } }else{ right=mid; } } cout<