Skip to main content
Back to problems
Codeforces
Easy
Arrays
Math
Table

Determine the value placed at a given row and column of a 5-row multiplication table with a column-dependent offset.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.

A. Table

gfg
Problem Statement

Table

You are given two integers nn and mm representing a position in a table with 5 rows. The value in row ii and column jj is formed using a simple arithmetic rule based on the row number and the column number.

For the requested cell, compute and print the table value directly.

The task is straightforward and is meant to test careful implementation of a small formula rather than advanced algorithms.

Input Format

  • A single line contains two integers nn and mm.
  • They describe the requested cell in the table.

Output Format

  • Print one integer: the value of the table at position (n,m)(n, m).

Constraints

  • 1n51 \le n \le 5
  • 1m1091 \le m \le 10^9

(These are sufficient for the direct formula-based solution.)

Examples
Sample cases returned by the problem API.

Example 1

Input

3 4

Output

12

Explanation

Using the table rule, the value at row 3 and column 4 is 12.

Premium problem context

Unlock deeper context for this problem

Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.