mathemaytic solution perfect