Update Main.java

Computation for getting the total distance added