There are two countries, Imperial Cacao and the Principality of Cocoa. Alice, the Empress of Cacao, and Brianna, the Princess of Cocoa, are friends, and both of them love chocolate.
One day Alice found a transparent tube filled with chocolate balls. The tube has a single opening at its top end, and it is so narrow that the chocolate balls sit in one line. The balls are numbered 1 through N. Ball 1 is next to the opening, ball 2 is right below it, and ball N is at the bottom of the tube. A ball can leave the tube only through the opening, so the balls must be taken out in increasing order of their numbers.
Alice visited Brianna to share the tube. They looked at the balls carefully and decided that ball i has nutrition value ri and deliciousness si. Each of them wants to maximize the total deliciousness of the balls she eats. To settle this peacefully, they play a game with the following rules.
Compute the total deliciousness Alice gets and the total deliciousness Brianna gets when both play optimally.
The input is a single test case in the following format.
N A B
r1 s1
r2 s2
...
rN sN
The first line has three integers N, A, and B. N is the number of chocolate balls, and A and B are the initial energy levels of Alice and Brianna. Each of the next N lines describes one ball, from the top of the tube down. The i-th of those lines has the nutrition value ri and the deliciousness si of ball i.
Print two integers on one line, separated by a space: the total deliciousness Alice gets and the total deliciousness Brianna gets when both play optimally.