upstream and downstream river formula