refactoring calculate_risk_input