← Back to Problems
Pinned to Settle
Medium standard Stochastic Calculus
Time limit: 1 s per test  ·  Memory: 256 MB

A large cash-settled contract on a stock expires at time T. Over the session [0, T], the stock's log-price X_t is a Gaussian process with continuous paths, starting at X_0 = 0, with

E[X_t] = b * t / T
Cov(X_s, X_t) = sigma^2 * (min(s, t) - s * t / T)

A barrier option knocks in if the log-price reaches the level a > 0 at any time in [0, T]. Compute the probability that the option knocks in.

Input

Four numbers sigma, a, b and T, each with at most 6 digits after the decimal point.

Output

One real number: the knock-in probability, with relative error at most 1e-9.

Constraints

0.01 <= sigma <= 5

0.001 <= a <= 20

-20 <= b <= 20

0.001 <= T <= 30

2 * a * (a - b) <= 600 * sigma^2 * T

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
1 1 0 1
output
1.353352832366127e-01
input
0.2 0.5 1 2
output
1.000000000000000e+00
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