finished first problem in srm565 div2