Easy Equation
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

You are given four positive integers 𝑥, 𝑦, 𝑧, 𝑘, please help little M calculate the number of equations 𝑥 + 𝑦 + 𝑧 = 𝑘 when 0 ≤ 𝑥 ≤ 𝑎, 0 ≤ 𝑦 ≤ 𝑏, 0 ≤ 𝑧 ≤ 𝑐, 0 ≤ 𝑘 ≤ 𝑑 

输入描述:

Four integers 𝑎, 𝑏, 𝑐, 𝑑 (0 ≤ 𝑎, 𝑏, 𝑐, 𝑑 ≤ ) 

输出描述:

One integer the number of equations.
It is guaranteed that all the answers fit 64-bit integer.
示例1

输入

复制
3 3 3 3

输出

复制
20
示例2

输入

复制
300 300 300 300

输出

复制
4590551
示例3

输入

复制
0 0 0 0

输出

复制
1
示例4

输入

复制
12345 12345 12345 12345

输出

复制
313713415596