in ABBYY wonderful Smart Beaver live this time begin study history when read Roman Empire interested life merchantsThe Roman Empire consist n city number 1 n it m bidirectional road number 1 m each road connect different city any city connect roadwe path city c1 c2 exist finite sequence city t1t2tp p1 t1c1 tpc2 1ip city ti ti1 connect road we know exist path city Roman EmpireIn Empire k merchant live number 1 k for merchant know pair number si li si number city merchant warehouse li number city shop the shop warehouse locate different city merchant deliver good warehouse shopLets road important merchant destruction threaten ruin merchant road path merchant warehouse shop Merchants Roman Empire greedy merchant pay tax 1 dinar road important in word merchant pay di dinar tax di di0 number road important ith merchantThe tax collection day come Empire the Smart Beaver ABBYY curious nature decide count dinar merchant pay day and need help