PROBLEM 16
Easy

Rectangle Perimeter

Programming Basics · Python

</>
STATUS Not solved

TASK

Problem

#16

Given rectangle sides `a` and `b`, print its perimeter.

EXAMPLE

Example

Input
4 7
Output
22

LIMITS

Constraints

a > 0; b > 0
📖
LEARN Theory for this problem
+

`input()` reads data entered by the user. The result of `input()` is initially a string. `split()` separates one input line into individual values using spaces. `map()` applies the specified conversion to each input value. The `+` operator adds numbers. The `*` operator multiplies numbers. `print()` displays the program result. Print only what the problem statement requires.

**Connection to this task.** The `*` operator multiplies numeric values. In formulas it naturally models repeated contribution, such as price × quantity, speed × time, or side × side. The expression `2 * (a + b)` shows how this idea is applied to the task data.

💡
NEED HELP? Hints
+

['Use `2 * (a + b)`.']

ANSWER Solution
+
a, b = map(int, input().split())
result = 2 * (a + b)
print(result)