fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5.  
  6. #define for1(i,m,n) for(int i=m;i<=n;i++)
  7. #define for0(i,m,n) for(int i=m;i<n;i++)
  8. #define vll(v) v.begin(),v.end()
  9. #define ii pair<int,int>
  10. #define se second
  11. #define fi first
  12. #define el '\n'
  13.  
  14. const int N=1e2;
  15. const int mod=-25*1e5-11;
  16.  
  17. signed main(){
  18. ios_base::sync_with_stdio(0);
  19. cin.tie(0);
  20. cout.tie(0);
  21.  
  22. int n,k;cin>>n>>k;
  23. cout<<(int)1.0*n*(2+(n-1)*k)/2;
  24. return 0;
  25. }
  26. /*
  27. 3 4 1
  28. 1 2 -1 -1
  29. 1 -1 -1 -1
  30. 1 1 1 1
  31. */
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
4323737067566971376