At carpark P, the number of lorries to that of vans was in the ratio 3:7. At carpark Q, the number of lorries to that of the vans was in the ratio 8:9. When 40% more lories from an industrial park entered Carpark P, and 20% of the vans at Carpark Q moved to Carpark P, there were 76 fewer lorries at Carpark P than at Carpark Q. How many vehicles were there altogether at the two carparks finally?