func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const int maxn = 100005;   int a[3], d;   void Solve() {     cin >> a[0] >> a[1] >> a[2] >> d;     sort(a, a + 3);     long long res = 0;     if (a[2] < a[1] + d) res += a[1] + d - a[2];     if (a[0] > a[1] - d) res += a[0] - a[1] + d;     cout << res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     if (fopen(                  .inp ,                r )) {       freopen(                         .inp ,            r , stdin);       freopen(                         .out ,            w , stdout);     }     int test_case = 1;     while (test_case--) Solve();     return 0;   }   