Risky Bank Lending and Optimal Capital Adequacy Regulation