Economics and Optimal Investment Policies of Attackers and Defenders in Cybersecurity