this is not min sum but i tried