Polycarp and the Day of Pi

CodeForces - 1790A