Added solution for computing the cost for tiles.