Update main.js

distance formula