Shivam and Medha are best friends. Shivam and Medha were comparing their ages and found that Medha is as old as Shivam was when Medha was as old as Shivam had been when Medha was half as old as Shivam is . If the sum of their present ages is years , then Shivam's age is