Skip to main content
Back to problems
Codeforces
Easy
Math
Simulation
Soroban

Simulate the Japanese soroban abacus and compute the value represented by its bead positions.

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

You are given the state of a Japanese soroban (abacus) after some digits have been set. The abacus represents a decimal number using multiple columns, where each column stores one digit from 0 to 9.

For each column, determine the digit encoded by the arrangement of beads, then output the full number represented by the soroban.

The key idea is to read each column independently and combine the digits from left to right as a decimal number.

Input Format

  • The first line contains the number of columns.
  • The following lines describe the state of the soroban columns.
  • Each column can be interpreted independently to obtain one decimal digit.

Output Format

Print the decimal number represented by the soroban state.

Constraints

  • The number of columns is small enough for direct simulation.
  • Each column encodes exactly one digit from 0 to 9.
  • Leading zeros may appear in the representation.
Examples
Sample cases returned by the problem API.

Example 1

Input

3
0 1 2

Output

12

Explanation

Reading the three columns as digits gives 0, 1, and 2; the leading zero does not change the numeric value, so the result 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.