A. Petr and a calendar

time limit per test:2 seconds
memory limit per test:256 megabytes
input:standard input
output:standard output

Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells contain dates. For example, a calendar for January 2017 should look like on the picture:

Petr wants to know how many columns his table should have given the month and the weekday of the first date of that month? Assume that the year is non-leap.

Input

The only line contain two integers m and d (1 ≤ m ≤ 12, 1 ≤ d ≤ 7) — the number of month (January is the first month, December is the twelfth) and the weekday of the first date of this month (1 is Monday, 7 is Sunday).

Output

Print single integer: the number of columns the table should have.

Examples

input

1 7

output

6

input

1 1

output

5

input

11 6

output

5

Note

The first example corresponds to the January 2017 shown on the picture in the statements.

In the second example 1-st January is Monday, so the whole month fits into 5 columns.

In the third example 1-st November is Saturday and 5 columns is enough.

 //2017.01.31
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int mouth[] = {, , , , , , , , , , , , }; int main()
{
int m, d;
while(cin>>m>>d)
{
int ans = (mouth[m]-(-d+)-)/++;
cout<<ans<<endl;
} return ;
}

CodeForces760A的更多相关文章

随机推荐

  1. 算法逆向6——RSA识别

    本文原创作者:i春秋作家——icq5f7a075d 1. 算法介绍 RSA算法是一种用数论构造的.基于大合数因子分解困难性的公开密钥密码.由于RSA密码既可用于加密,又可用于数字签名,安全.易懂,因此 ...

  2. svn update 产生Node remains in conflict的问题

    输入:sudo svn revert --depth=infinity frontend/web/js/workplace/organization.js 最后在执行 svn  up  就ok了

  3. JSON.stringify和JSON.parse的使用

    JSON.stringify 函数 (JavaScript)将 JavaScript 值转换为 JavaScript 对象表示法 (Json) 字符串.JSON.stringify(value [, ...

  4. 无头结点的单链表(C语言)

    1.单链表: 在顺序表中,用一组地址连续的存储单元来一次存放线性表的结点,因此结点的逻辑顺序与物理顺序是一致的.但链表却不同,链表是用一组任意的存储单元来存放 线性表的结点,这组存储单元可以是连续的, ...

  5. Window Screen对象

    window.screen 对象包含有关用户屏幕的信息. window.screen对象在编写时可以不使用 window 这个前缀.一些属性: screen.availWidth // 可用的屏幕宽度 ...

  6. 移动端h5直播项目|html5直播实战开发|h5仿陌陌

    最近一些直播.小视频什么的都比较火,像陌陌.抖音.火山短视频… 于是空闲时间自己也利用html5技术也试着倒腾了下直播项目,使用到了h5+css3+iscroll+zepot+swiper+wlsPo ...

  7. Centos 6.5下的OPENJDK卸载和SUN的JDK安装、环境变量配置

    不多说,直接上干货! 说明 图形界面安装,会自带有Centos6.5自带的OPRNJDK!!! *********************************自带的OPENJDK的卸载****** ...

  8. window启动程控制

    1.启动服务管理(RPC) 2.开启远程选项 3.开启防火墙允许

  9. android studio 3.1.4下载安装配置(附旧版本下载地址)

    windows下安装android studio.当前时间2018年9月. 最新版本的android studio3.2.0-release出来了,拥有许多新的特性 可能我是一个业余的android开 ...

  10. 06-python中的装饰器

    java类中, 有一系列的装饰器, 尤其对文件的操作, python的装饰器比较简单, 直接上代码 #!/usr/bin/env python3 #coding:utf- ''' python的装饰器 ...