once Vasya Petya assemble figure m cube associate number 0 m1 inclusive number appear exactly Lets consider coordinate system ox ground OY direct upwards each cube associate coordinate low leave corner coordinate integer cubethe figure turn stable this mean cube ground cube cube touch corner more formally mean cube coordinate xy y0 cube coordinate x1y1 xy1 x1y1Now boy want disassemble figure cube row in step cube remove figure right block lay the guy remove cubes order figure remain stable to process interesting guy decide play follow game the guy cube figure turn it easy figure disassemble integer write cube form number write mary positional numerical system possibly lead zero Vasya want result number maximum possible Petya contrary try small possible Vasya start gameYour task determine number form figure disassemble boy play optimally determine remainder answer modulo 1099