The PDF version of this problem can be downloaded here.
1 4 1000000 0 2 2 1 3 8 6 3
2 3 4 1 2
Migrated from old NTUJ.
Hsinchu icpc 2011