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. bzoj 1083 繁忙的都市

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1083 题解: 在bzoj里能遇到如此如此水的题真是不容易…… 乍一看好像有点吓人,其实是一 ...

  2. mysql中间件 -> Atlas简介&安装

    Atlas简介 Atlas是由 Qihoo 360公司Web平台部基础架构团队开发维护的一个基于MySQL协议的数据中间层项目.它在MySQL官方推出的MySQL-Proxy 0.8.2版本的基础上, ...

  3. python网络编程-多进程multiprocessing

    一:mutilprocess简介 多线程类似于同时执行多个不同程序,多线程运行有如下优点: 使用线程可以把占据长时间的程序中的任务放到后台去处理. 用户界面可以更加吸引人,这样比如用户点击了一个按钮去 ...

  4. MFC中CString.Format类详解

    在MFC程序中,使用CString来处理字符串是一个很不错的选择.CString既可以处理Unicode标准的字符串,也可以处理ANSI标准的字符串.CString的Format方法给我们进行字符串的 ...

  5. java IO流之——File类知识总结和面试

    File类描述的是一个文件或文件夹.(文件夹也可以称为目录).该类的出现是对文件系统的中的文件以及文件夹进行对象的封装.可以通过对象的思想来操作文件以及文件夹.可以用面向对象的处理问题,通过该对象的方 ...

  6. delphi TComponent类 2

    来自:http://blog.csdn.net/lailai186/article/details/7442385 ------------------------------------------ ...

  7. NYOJ 石子合并(一)(区间DP)

    题目链接:http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=737 题目大意: 有N堆石子排成一排,每堆石子有一定的数量.现要将N堆石子并成为一堆 ...

  8. 根据后端传的时间前端js进行倒计时

    一.故事背景: 1. 今天公司有个项目需求 2. 在前端页面实现一个倒计时功能 3. 初步设想:后端根据需求规定一个未来的时间,前端根据当前时间进行计算 4. 然后将时间格式化,时分秒的格式 5. 时 ...

  9. 20155225 2006-2007-2 《Java程序设计》第3周学习总结

    20155225 2006-2007-2 <Java程序设计>第3周学习总结 教材学习内容总结 封装对象内部数据:使用private关键字定义类的私有成员 如果不使用private定义的话 ...

  10. Struts 2 - Environment Setup

    Our first task is to get a minimal Struts 2 application running. This chapter will guide you on how ...