If the third leg of Rick's trip was half the distance of the first leg, was 40 miles, this means the first leg was 40*2=<<40*2=80>>80 miles long
If the second leg of the trip was twice the distance of the first leg, that means it was 80*2=<<80*2=160>>160 miles long
If the fourth leg was equal in distance to the total amount traveled across the first 3 legs, that means it was equal to 40+80+160= <<280=280>>280 miles long
This means in total Rick traveled 280+280= <<280+280=560>>560 miles
#### 560