Infinite Sequence (Hard Version)

Problem Name:
Infinite Sequence (Hard Version)
Site:CodeForces
Links:
Tags: