Implemented RectangularGrid problem in SRM 146 DIV 1