If the sum of first 777 terms of an AP is 494949 and that of 171717 terms is 289289289, find the sum of first nnn terms.