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bWCRSvY6deXDRhmJndLcLyn83KgZtuvWrIt3EsUMn95HG/+pQ1RGO00vw3jtLBZSyMowiIhyMfE0mNvlUosVeK2tInKl44Io3K/l5lUA8vpWsZpm3boL0rPtWCmsxXRktFFFAmKMUtFAmKMUtFBjikIrLFFBjilxS4paDGsSKzpDQaHWmcsQOdq6JUVqaPPapRGbyBkLOgHNgjB6H3rlXGrX0YwkMS422y38dvtUwmtQ4O1cefSY3YkjrWdKiUuoarcEgyyBTkYQlRv/lwPtWUFvduQcOfepTHpMCf2Yp7HZIuMKPpTQ5unQTpy8w2qRQKcDNa44AvQU8jTFaiNi1sFYqKzqgpaBRQFJS0UCUUtFAlFFFAUUtFAlFFFAlJWVGKDWVFaGiBPSnNJiga+EKyEYrfyilxQawnStgGKXFLQAFLRRQLRRRQFFJS0BRSUtAUUlFAtFFJQLgUUUVQUYoooDAo5RRRQGBSYFFFAuBRRRQFFFFAUUUUBRRRQFFFFAUUUUBRRRQf/9k=)
![](https://tse2-mm.cn.bing.net/th/id/OIP-C.ojcWO_62WQhtFFaZSdmbgAHaEo?w=244&h=180&c=7&r=0&o=5&pid=1.7)
Arrda 家里面有很多五花八门的用电器和数据线,而且很多用电器的插头种类都不一样,这导致每次 Arrda 想要共享两个用电器的数据时都要一半天用来买到合适的数据线,而且有的时候数据线很贵!
于是 Arrda 想让你求出花钱最少的数据转换方案。
题目描述
Arrda 家中有 $n$ 类,$2n$ 种数据线接头,每一类插头有 $2$ 种不同接头,种类分别为 $i$ 和 $n+i$,**有且只有同一类的不同接头可以互相连接(你可以理解为 $i$ 是凸出的接头,$n + i$ 是凹的接头,可以连接可以理解为插上)**。
商城里售卖着 $m$ 种双向数据线,每根双向数据线两端各有一个接头,种类分别为为 $u_i,v_i$。同时,第 $i$ 种双向数据线有一个购买价格 $w_i$,每种数据线可以购买无限条。
Arrda 想要交换两个用电器的数据,其中两个用电器的接头种类编号为 $S,T$,求能使这两个用电器能直接或由若干条数据线相连的最小总价格(毕竟买数据线需要钱),如果无解,输出 `I have no idea how to solve it.`,注意,**两个用电器的接口不能直接连接数据线,因为它们在用电器上,而非数据线两端!**
输入输出格式
输入格式
第一行两个整数 $n,m$,意义见题面。
接下来 $m$ 行,每行三个整数 $u_i,v_i,w_i$。
接下来一行两个整数 $S,T$。
输出格式
一个非负整数表示能使这两个用电器能直接或由若干条数据线相连的最小总价格。
若无解,请输出 `I have no idea how to solve it.`。
输入输出样例
输入样例 #1
4 4
5 8 10
7 8 2
2 3 1
5 6 5
1 4
输出样例 #1
8
输入样例 #2
4 1
2 3 1
1 8
输出样例 #2
I have no idea how to solve it.
输入样例 #3
4 1
2 3 1
1 5
输出样例 #3
0
输入样例 #4
5 10
1 2 603124134
2 3 373980902
2 4 6578324
3 5 936364479
4 6 182080546
4 7 340293479
6 8 753053273
1 9 274129271
3 10 616764767
4 6 255802600
1 2
输出样例 #4
3673658542
说明
### 样例 1 解释:
![picture](https://cdn.luogu.com.cn/upload/image_hosting/4j95t4xl.png)
```
1=5->6=2->3=7->8=4
```
可以证明,没有总代价更小的方案。
### 样例 4 解释
![222](https://cdn.luogu.com.cn/upload/image_hosting/k88cjz1t.png)
```
1=6->8=3->5=10->3=8->6=1->9=4->7=2
```
`4->6` 有两种数据线,我们选择代价为 $182080546$ 的那一根,因为其代价更小。
可以证明,没有总代价更小的方案。
### 数据范围
对于 $100\%$ 的数据,$1\le n,m \le 10^5$,$1\le u_i,v_i,s,t \le 2 \times n$,$1\le w_i \le 10^9$。