Problem description

For a positive integer n let's define a function f:

f(n) =  - 1 + 2 - 3 + .. + ( - 1)nn

Your task is to calculate f(n) for a given integer n.

Input

The single line contains the positive integer n (1 ≤ n ≤ 1015).

Output

Print f(n) in a single line.

Examples

Input

4

Output

2

Input

5

Output

-3

Note

f(4) =  - 1 + 2 - 3 + 4 = 2

f(5) =  - 1 + 2 - 3 + 4 - 5 =  - 3

解题思路:简单求前n项和,分为奇数和偶数两种情况,水过!

AC代码:

 #include <bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
if(n&)cout<<(n/-n)<<endl;
else cout<<(n/)<<endl;
return ;
}

最新文章

  1. 【AutoMapper官方文档】DTO与Domin Model相互转换(中)
  2. AndroidStudio里面怎么取消与SVN的关联
  3. iOS 中的字体预览
  4. 线程入门之实现Runnable接口和继承Thread类
  5. iOS - OC NSNull 空值
  6. 可滑动的ToggleButton(开关)
  7. CCS5 编译器手动设置dsp支持可变参数宏等问题
  8. 量化生产力Quantifying Productivity
  9. http响应Last-Modified和ETag(转)
  10. iOS 将图片保存到本地
  11. HTML的基本介绍
  12. Android逆向分析(2) APK的打包与安装背后的故事
  13. dataTable tab栏切换时错位解决办法
  14. PermissionDispatcher 运行时权限框架
  15. 给 datepicker 设定日期格式
  16. Windows Server 2012 RS 配置IIS8.0+发布网站
  17. cocos2d-x 开发用到的工具
  18. Linux命令之rz命令与sz命令
  19. _spellmod_on_learn、_spellmod_on_remove
  20. C#基础篇七类和静态成员

热门文章

  1. CNN结构:用于检测的CNN结构进化-结合式方法
  2. AI.框架理论.语义网.语言间距.孤单
  3. tomcat映射java目录 sever.xml
  4. BZOJ 1705: [Usaco2007 Nov]Telephone Wire 架设电话线 DP + 优化 + 推导
  5. SharePoint Designer 2013 开启新式验证(Modern Authentication)
  6. Java 实现邮件发送功能
  7. tornado服务器运行django应用
  8. 编码的由来,ASCII编码,和字节的形成
  9. C#--线程池与线程的种类
  10. java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.getXmlStandalone()Z解决办法