alot faster solution after som math research