Look up the journey from SHF to SNF, look at all the stations the trains call at, download the fares splitting at each station, add the fares.  It&#x27;s about 10 minutes to do by hand, if you did it a lot then you could easily script it.<p>You can get the train times and fares with a curl on the NRE web site, parse with regex (never do that, but in this case it&#x27;s a trivial hack - fix it later with your favorite &quot;proper&quot; parser), then look at all the combinations.  I imagine Dijkstra would be quick, but it&#x27;s quick enough just to do a DFS through the combinations.