import Control.Applicative
import Data.List
main = inputOutput
inputOutput = do
maxPair xxs p
= f
0 =<< reverse $ sort xxs
where
f r (x:xs) (y:ys)
| x == y = r
| l > p = f r xs (y:ys)
where l = x + y
f r _ _ = r
aW1wb3J0IENvbnRyb2wuQXBwbGljYXRpdmUKaW1wb3J0IERhdGEuTGlzdAoKbWFpbiA6OiBJTyAoKQptYWluID0gaW5wdXRPdXRwdXQKCmlucHV0T3V0cHV0IDo6IElPICgpCmlucHV0T3V0cHV0ID0gZG8KICBbbiwgZF0gPC0gbWFwIHJlYWQgPCQ+IHdvcmRzIDwkPiBnZXRMaW5lCiAgbHMgICAgIDwtIGxpbmVzIDwkPiBnZXRDb250ZW50cwogIGxldCAocHMwLCBtczApID0gc3BsaXRBdCBuIGxzCiAgICAgIG1zID0gbWFwIHJlYWQgJCB0YWtlIGQgbXMwCiAgICAgIHBzID0gbWFwIHJlYWQgcHMwCiAgcHV0U3RyTG4gJCB1bmxpbmVzICQgbWFwIHNob3cgJCBtYXAgKG1heFBhaXIgcHMpIG1zCgptYXhQYWlyIDo6IFtJbnRdIC0+IEludCAtPiBJbnQKbWF4UGFpciB4eHMgcCA9IGYgMCA9PDwgcmV2ZXJzZSAkIHNvcnQgeHhzCiAgd2hlcmUKICAgIGYgciAoeDp4cykgKHk6eXMpCiAgICAgIHwgeCA9PSB5ICAgID0gcgogICAgICB8IGwgPiBwICAgICA9IGYgciB4cyAoeTp5cykKICAgICAgfCBvdGhlcndpc2UgPSBmIChtYXggbCByKSAoeDp4cykgeXMKICAgICAgICB3aGVyZSBsID0geCArIHkKICAgIGYgciBfICAgICAgXyAgPSByCg==