Flash Memories: Economic Principles of Performance, Cost and Reliability Optimization