#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int x,n; cin >> x >> n; for(long long int i = 1; i<=n; i++){ if(x<=0) x += i; else x-=i; } cout << x; // your code goes here }