how to calculate tile layout - Search