On optimal control of capital injections by reinsurance and investments