To cross the river in shortest distance