1881. Long problem statement

Problem Name:
1881. Long problem statement
Site:Timus
Links:
Tags:
Problem setters:
Fedor Fominykh