Description

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.

Examples
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<bits/stdc++.h>
using namespace std;
class P
{
public:
int n,m;
};
bool cmd(P x,P y)
{
return x.n<y.n;
}
int main()
{
long long ans=0;
string s;
cin>>s;
if(s.length()==1)
{
ans+=s[s.length()-1]-'0';
}
else
{
ans+=((s[s.length()-2]-'0')*10+s[s.length()-1]-'0');
}
// cout<<ans<<endl;
if(ans%4)
{
cout<<"0"<<endl;
}
else
{
cout<<"4"<<endl;
}
return 0;
}

  

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

  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. 1) D. Serega and Fun 分块

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

  5. Codeforces Round #260 (Div. 1) C. Civilization 并查集,直径

    C. Civilization Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/probl ...

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

    A. Boredom Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/problem/A ...

  7. Codeforces Round #260 (Div. 1) A. Boredom (简单dp)

    题目链接:http://codeforces.com/problemset/problem/455/A 给你n个数,要是其中取一个大小为x的数,那x+1和x-1都不能取了,问你最后取完最大的和是多少. ...

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

    题目链接:http://codeforces.com/problemset/problem/455/A A. Boredom time limit per test 1 second memory l ...

  9. Codeforces Round #260 (Div. 2)

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

  10. Codeforces Round #260 (Div. 2) C

    Description Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. On ...

随机推荐

  1. ligerui_ligerTree_001_第一个“树”效果

    折叠.展开.有复选框.没有复选框: 源码地址:http://download.csdn.net/detail/poiuy1991719/8571255 效果图: <%@ page languag ...

  2. 夺命雷公狗---node.js---20之项目的构建在node+express+mongo的博客项目5mongodb在项目中实现添加数据

    我们上一步就引入了mongodb了,那么下一步就要开始写添加数据了,不过有个前提是先将表单的数据处理好: 最基本的这部现在已经成功了,因为最基本的这步就是先将表单处的提交方式和提交地址给处理好,这里和 ...

  3. 夺命雷公狗---DEDECMS----17dedecms头条信息的取出

    我们在有些开发时候可能会用到些头条的文章,,添加过程如下所示: 我们在前台遍历数据的时候可以这样, 然后在后台更新首页模版后在去看下首页,效果如下所示:

  4. DFT basics

    DFT测试中,最重要的部分还是sequential circuit的内部状态的测试. 起初ad hoc的方法用来提高testability,可以提高局部的coverage,但并不是一个系统性的方法. ...

  5. linux系统的时间调整

    以centos为例,其它系统应该是一样或者类似的. 需要用到两个命令: date 和 hwclock 其中 date 命令由 coreutils 这个包提供, hwclock 命令由 util-lin ...

  6. [经典php视频]构建正则表达式解析网页中的图像标记<img>

    这是高洛峰php视频中的一段,视频中一边分析需要的功能,一边构建greg_match函数的参数,边讲解边实战,是非常好的一种构建功能的演示. 你不可能把浩瀚的IT资料都记在脑袋里,也不可能随时随地透过 ...

  7. HttpHandler和ashx要实现IRequiresSessionState接口才能访问Session信息(转载)

    通常我们经常,通过session判定用户是否登录.还有一些临时的.重要的数据也尝尝存放在Session中. 在页面我们很容易的得到Session的值,但在类中就会遇到一些问题.也知道通过下面的方法得到 ...

  8. Spring+SpringMVC+MyBatis)

    用SSM(Spring.SpringMVC和Mybatis)已经有三个多月了,项目在技术上已经没有什么难点了,基于现有的技术就可以实现想要的功能,当然肯定有很多可以改进的地方.之前没有记录SSM整合的 ...

  9. win7 dos命令窗口内容显示不全解决办法--将命令执行结果输出到一个文件中

    执行命令:命令 >>某某路径\文件全名

  10. 160923、项目管理模式:如何去除SVN标记

    项目管理模式:如何去除SVN标记 当我们从工作空间中拷贝一个项目,发现项目特别大.那是因为当使用svn里面保留了每个版本的信息,我们可以通过这个方法来进行去除 当项目不需要SVN标志的时候,我们一般怎 ...