Why this solution spoj.com/problems/UCV2013I/
There are comments about the value of Pi in the problem page. Take a look at them. Please post back if you have more questions.