import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
a, b, c, n = map(int, input().split())
if min(a, b) < c:
ans = -1
else:
x = n - (a + b - c)
ans = x if x > 0 else -1
print(ans)
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |