1003. Emergency (25)
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected bysome roads. Amount of rescue teams in each city andthelengthof each road between any pair of cities are marked onthe map. When there is an emergency call to you fromsome other city, your job isto lead your men tothe place as quickly as possible, andatthe mean time, call up as many hands onthe way as possible.
Input
Each input filecontains one test case. For each test case, thefirst line contains4 positive integers: N (<= 500) - thenumberof cities (andthe cities are numbered from0to N-1), M - thenumberof roads, C1 and C2 - the cities that you are currently inandthat you must save, respectively. The next line contains N integers, wherethe i-th integeristhenumberof rescue teams inthe i-th city. Then M lines follow, each describes a road with three integers c1, c2 and L, which are the pair of cities connected by a road <