Pagini recente » Cod sursa (job #3038215) | Cod sursa (job #2708000) | Cod sursa (job #2874762) | Cod sursa (job #2581416) | Cod sursa (job #3232700)
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
using i64 = int64_t;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef LOCAL
ifstream cin{"input.txt"};
ofstream cout{"output.txt"};
#endif
i64 n;
cin >> n;
i64 res = 0;
i64 x, y, z;
i64 lx, ly, lz;
for (i64 i = 0; i < n; i++) {
cin >> x >> y >> z;
if (i == 1) {
res += lx - x + ly - y + lz - z + 3;
lx = x, ly = y, lz = z;
} else if (i > 0) {
res += lx - x + ly - y + lz - z + 3;
lx++, ly++, lz++;
} else if (i == 0) {
lx = x, ly = y, lz = z;
}
}
cout << res;
return 0;
}