시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB104534651.111%

문제

While you were out travelling, you won the lottery. As it happened, the top prize of this lottery was not cash, but candies! Now you are stuck with a big pile of candies which you would like to take home. Fortunately, you have been able to acquire a truck, so now all you have to do is drive home.

Going from one country to another with such a big pile of candies in your truck is not allowed without paying some taxes. And because everybody likes candies, you are allowed to pay these taxes with candies.

After searching a bit on the internet, you have found a list that tells you exactly which borders you can cross with a truck and for each such border what percentage of tax you have to pay to cross it. You cannot pay with fractional candies and the candies are quite nice, so customs will always round up. You only have to pay taxes on the number of candies you bring across the border.

What is the maximum number of candies you can bring home?

입력

The input consists of:

  • One line containing two integers $n$ ($2\leq n\leq 1\cdot 10^5$), the number of countries, and $m$ ($1 \leq m \leq 2\cdot 10^5$), the number of borders. 
  • One line containing three integers $s$ ($1\leq s\leq n$), the country where you won the lottery, $t$ ($1 \leq t \leq n$, $t\neq s$), your home country and $c$ ($1\leq c \leq 10^9$) the number of candies you won in the lottery.
  • Then follow $m$ lines containing three integers $u, v$ ($1\leq u, v \leq n$, $u\neq v$) and $p$ ($0 \leq p \leq 100$) where $p$ is the percentage of tax you have to pay when travelling from country $u$ to $v$ or vice versa.

It is guaranteed you can drive home with your truck, and that each pair of countries is listed at most once.

출력

Output the maximum number of candies you can arrive home with.

예제 입력 1

4 4
1 4 1000
1 2 25
2 4 10
1 3 4
3 4 30

예제 출력 1

675

예제 입력 2

5 5
1 5 6
1 2 17
2 5 19
1 3 1
3 4 1
4 5 1

예제 출력 2

3

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2021 Preliminaries C번

  • 문제를 만든 사람: Ruben Brokkelkamp