← Back to Problems
Expected Shortfall
Easy standard Portfolio Optimization Probability & Statistics
Time limit: 1 s per test  ·  Memory: 256 MB

The one-day loss of a trading book is normally distributed with mean mu and standard deviation sigma (positive values are losses). The regulator fixes an exceedance probability of 10^-k: the confidence level is alpha = 1 - 10^-k.

The Value at Risk VaR is the alpha-quantile of the loss. The Expected Shortfall ES is the expected loss conditional on the loss being at least VaR. Compute both.

Input

Three numbers mu, sigma and k: the first two are reals with at most 6 digits after the decimal point, k is an integer.

Output

Two real numbers: VaR and ES, each with relative error at most 1e-9.

Constraints

0 <= mu <= 10^6

0.01 <= sigma <= 10^6

2 <= k <= 5000

Scoring

This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.

Numeric answers are accepted if they are within a relative tolerance of 1e-09 of the expected value.

Examples

input
0 1 2
output
2.326347874040841 2.665214220345805
input
120.5 35.25 4
output
251.59533111231275 260.03640828287706
Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2