← Back to Problems
Put-Call Parity
Easy standard Pricing
Time limit: 1 s per test  ·  Memory: 256 MB

A European call on a non-dividend-paying stock trades at price C. The stock trades at S_0, the call has strike K and expiry T, and the continuously compounded risk-free rate is r.

Compute the arbitrage-free price of the European put with the same strike and expiry.

Input

Five numbers C, S_0, K, r and T.

Output

One real number: the put price, with absolute or relative error at most 1e-9.

Constraints

0 < S_0, K <= 10^4

-0.05 <= r <= 0.1

0.001 <= T <= 30

C is arbitrage-consistent

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 an absolute tolerance of 1e-09 or a relative tolerance of 1e-09 of the expected value.

Examples

input
8.9160372786 100 100 0.02 1
output
6.935904609248e+00
input
6.7768735266 50 60 0.05 2
output
1.106711860873e+01
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