#Java, 283 bytes static void p(String p,String l){int[]d={50290000,41400000,78340000,550390000,646270000,1448950000,1627450000};String q="MeVeEaMaJuSaUr";int w=q.indexOf(p.substring(0,2))/2,e=q.indexOf(l.substring(0,2))/2,h=0,m=1,t=e;if(w>e){e=w;w=t;m=-1;}for(;e--!=w;)h+=d[e];System.out.print(h*m);} Input/Output: p("Mercury","Mars") --> 170030000 p("Mars","Mercury") --> -170030000 p("Earth","Earth") --> 0 Spaced and tabbed: static void p(String p,String l){ int[]d={50290000,41400000,78340000,550390000,646270000,1448950000,1627450000}; String q="MeVeEaMaJuSaUr"; int w=q.indexOf(p.substring(0,2))/2, e=q.indexOf(l.substring(0,2))/2, h=0, m=1, t=e; if(w>e){ e=w; w=t; m=-1; } for(;e--!=w;) h+=d[e]; System.out.print(h*m); }