This page is still under construction.

Parts of this page are still being built. What you see may change.

Roll the Dice

Time limit1sMemory limit128 MB

Summary
Count ordered pairs (a, b) with a from 1 to m, b from 1 to n, and a + b = 10, then print the count with singular or plural wording.
Level

Easy1 of 10

Topics
Math, Implementation, Brute force
Solved
No attempts yet

Problem

Diana is playing a game with two dice. The first die has mm faces labelled 1,2,3,…,m1, 2, 3, \ldots, m. The second die has nn faces labelled 1,2,3,…,n1, 2, 3, \ldots, n. Write a program that determines how many ways she can roll the two dice so that the two faces add up to 1010.

Each way is an ordered pair made of one face value from the first die and one face value from the second die whose sum is exactly 1010. Two ways are considered different if either die shows a different value.

Input

The input consists of two integers, each on its own line. The first line contains mm (1≤m≤10001 \le m \le 1000), the number of faces on the first die. The second line contains nn (1≤n≤10001 \le n \le 1000), the number of faces on the second die.

Output

Print the number of ways to roll a sum of 1010 on the two dice. Use the singular word "way" when there is exactly one way and the plural word "ways" otherwise. For example, when there is exactly one way, print:

There is 1 way to get the sum 10.

Otherwise, print in the following form (with the count filled in):

There are 5 ways to get the sum 10.

Examples2

  1. Example 1

    Input
    6
    8
    
    Expected output
    There are 5 ways to get the sum 10.
    
  2. Example 2

    Input
    12
    4
    
    Expected output
    There are 4 ways to get the sum 10.