B. Fedya and Maths
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expression:

(1n + 2n + 3n + 4nmod 5

for given value of n. Fedya managed to complete the task. Can you? Note that given number n can be extremely large (e.g. it can exceed any integer type of your programming language).

Input

The single line contains a single integer n (0 ≤ n ≤ 10105). The number doesn't contain any leading zeroes.

Output

Print the value of the expression without leading zeros.

Sample test(s)
Input
4
Output
4
Input
124356983594583453458888889
Output
0
Note

Operation x mod y means taking remainder after division x by y.

Note to the first sample:

#include <cstdio>
#include <cstring>
using namespace std;
char str[+];//注意拿数组进行储存
int main()
{
scanf("%s",str);
int len = strlen(str);
int sum = (str[len-]-'')*+str[len-]-'';
if(sum%==)puts("");//做题前先打表
else puts("");
return ;
}

Codeforces Round #260 (Div. 2) B. Fedya and Maths的更多相关文章

  1. DP Codeforces Round #260 (Div. 1) A. Boredom

    题目传送门 /* 题意:选择a[k]然后a[k]-1和a[k]+1的全部删除,得到点数a[k],问最大点数 DP:状态转移方程:dp[i] = max (dp[i-1], dp[i-2] + (ll) ...

  2. 递推DP Codeforces Round #260 (Div. 1) A. Boredom

    题目传送门 /* DP:从1到最大值,dp[i][1/0] 选或不选,递推更新最大值 */ #include <cstdio> #include <algorithm> #in ...

  3. Codeforces Round #260 (Div. 2)AB

    http://codeforces.com/contest/456/problem/A A. Laptops time limit per test 1 second memory limit per ...

  4. Codeforces Round #260 (Div. 2)

    A. Laptops 题目意思: 给定n台电脑,第i台电脑的价格是ai ,质量是bi ,问是否存在一台电脑价格比某台电脑价格底,但质量确比某台电脑的质量高,即是否存在ai < aj 且 bi & ...

  5. Codeforces Round #260 (Div. 2) B

    Description Fedya studies in a gymnasium. Fedya's maths hometask is to calculate the following expre ...

  6. Codeforces Round #260 (Div. 2) A B C 水 找规律(大数对小数取模) dp

    A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  7. Codeforces Round #260 (Div. 2) A~C

    题目链接 A. Laptops time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputo ...

  8. Codeforces Round #260 (Div. 2) A , B , C 标记,找规律 , dp

    A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  9. Codeforces Round #260 (Div. 1) D. Serega and Fun 分块

    D. Serega and Fun Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/pro ...

随机推荐

  1. Oracle11g用户、权限、角色、概要文件管理及审计

    第10章 安全管理 1 用户管理 2 权限管理 3 角色管理    : 4 概要文件管理 5 审计 操作系统:win7    Oracle安装目录:E盘 数据库名字:orcl  密码:123456 先 ...

  2. C 语言问题

    1.  如何生成 "半全局变量", 就是那种只能被部分源文件中的部分函数访问变量? 答: 这在C语言中办不到. 如果不能或不方便在一个源文件中放下所有的函数, 那么有三种的解决方案 ...

  3. MongoDB安全:创建角色(User-Defined Roles)

    MongoDB已经定义了一些内建角色,同时还提供了用户自定义角色的功能,以满足用户千差万别的需求. 官文User-Defined Roles中对其有简略介绍,但要熟悉怎么创建角色,还需要了解下面的这些 ...

  4. js实现数据视图双向绑定原理

    这个方法了不起啊..vue.js和avalon.js 都是通过它实现双向绑定的..而且Object.observe也被草案发起人撤回了..所以defineProperty更有必要了解一下了几行代码看他 ...

  5. mvn简单命令

    导出maven项目依赖的jar包 mvn dependency:copy-dependencies -DoutputDirectory=lib 编译Java代码 mvn compile eclipse ...

  6. hihoCoder #1184 : 连通性二·边的双连通分量(边的双连通分量模板)

    #1184 : 连通性二·边的双连通分量 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 在基本的网络搭建完成后,学校为了方便管理还需要对所有的服务器进行编组,网络所的老 ...

  7. Robust Mesh Watermarking

    之前看了一篇题为"Robust Mesh Watermarking"的论文,查阅资料的时候发现了一篇与之很相似的名为"三维模型数字水印系统的设计与实现"的中文论 ...

  8. pycharm、webstorm和idea激活码

    pycharm ---> http://blog.csdn.net/kevinelstri/article/details/57413791 idea ---> http://idea.l ...

  9. Oracle与Sqlserver数据共享

    需求:在一个集成平台中有一个主系统使用的是Oralce数据库,子系统使用的SqlServer 数据库,如何让子系统的数据库与主系统的人员同步呢? 思路:通过服务WebService 公开接口 1.与主 ...

  10. HTML5移动应用左右滑动touchmove touchmove touchend 实例

    也是刚开始接触移动前端,大虾别喷 <!DOCTYPE HTML> <html> <head> <meta name="viewport" ...