Order On The Tape

Three files are written end to end on a tape. To read a file the drive must scan past everything stored before it, so if file kk sits at position kk the cost of one read is the total length of files 1 through kk. Each file will be read a known number of times over the life of the tape, so the total cost of an ordering π\pi is

Σcost(π)=∑k=1nF[π(k)]⋅∑i=1kL[π(i)]\Sigma\text{cost}(\pi) = \sum_{k=1}^{n} F[\pi(k)] \cdot \sum_{i=1}^{k} L[\pi(i)]

file length LL reads FF
P 3 6
Q 10 10
R 8 4

Which ordering minimises the total, and what does it cost?

A

R, P, Q at a cost of 308

B

P, Q, R at a cost of 232

C

P, R, Q at a cost of 272

D

Q, P, R at a cost of 262