Ingress
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 102400/65535 K (Java/Others)
Total Submission(s): 440 Accepted Submission(s): 205
Problem Description
Brickgao, who profited from your accurate calculating last year, made a great deal of money by moving bricks. Now he became ``gay shy fool'' again and recently he bought an iphone and was deeply addicted into a cellphone game called Ingress. Now he is faced with a problem so he turns to you for help again. We make some slight modifications based on the original rules, so please draw attention to the details below.
There are portals (indexed from 1 to ) around Brickgao's home, and he can get some substances called XM by hacking the portals. It's known that for each portal , he can get XM during the first hack, and after each hack, the amount of XM he will get during the next hack will decrease by . If the amount of XM he can get is less than or equal to zero, Brickgao can't get XM from that portal anymore. For the -th portal, if and he hacks 3 times, he will get 10, 8, 6 XM during each hack.
There are bidirectional roads between some pairs of portals and between Brickgao's home and some portals. Now he is eager to start his Ingress journey from home and finally return home, but due to the extremely hot w