time limit per test : 3 seconds
memory limit per test : 256 megabytes
分数:2400
One important contest will take place on the most famous programming platform (Topforces) very soon!
The authors have a pool of n n n problems and should choose at most three of them into this contest. The prettiness of the i-th problem is a i a_i ai. The authors have to compose the most pretty contest (in other words, the cumulative prettinesses of chosen problems should be maximum possible).
But there is one important thing in the contest preparation: because of some superstitions of authors, the prettinesses of problems cannot divide each other. In other words, if the prettinesses of chosen problems are x , y , z x,y,z x,y,z, then x x x should be divisible by neither y y y, nor z , y z, y z,y should be divisible by neither x x x, nor z z z and z z z should be divisible by neither x x x, nor y y y. If the prettinesses of chosen problems are x x x and