Գրեք սա: Optimal resource allocation