This contest was a qualification round for Samara SAU teams. Winners will participate in ACM ICPC 2012-2013. Contest will be easy, a bit easier than our previous contest.
Input-output: standard console input-output (like at Codeforces rounds)
It's not recommended to use %lld for reading and writing 64-bit integers in GNU C++