n,p1,p2=map(int,input().split()) c=[tuple(map(int,input().split())) for i in range(n)] q=[0]*(1<>j)&1: a+=c[j][0] b+=c[j][1] if a<=p1: q[i]=b for j in range(n): for i in range(1<>j)&1: q[i]=max(q[i],q[i^(1<>j)&1: a+=c[j][0] b+=c[j][1] if a<=p2: g=max(g,b+q[((1<