optimal storage on tapes using greedy method