All problems

Problem 792

Sum of First and Last Digit

Easy · 10 pts · Math, Basics

Problem

Add the first (most significant) digit and the last digit of a non-negative integer N. For a one-digit number, that digit is both the first and the last, so it is counted twice. The last digit is N mod 10, and the first digit can be found by dividing by 10 until a single digit is left. The numbers in this problem can be larger than a 32-bit int can hold (about 2.1 × 10^9), so use a 64-bit integer type: long long in C++, long in Java (Python needs nothing special).

Input

A single integer N without leading zeros.

Output

Print the sum of the first and the last digit of N.

Constraints

0 <= N <= 10^18

Example input

4567

Example output

11

Explanation

In 4567 the first digit is 4 and the last digit is 7, so the answer is 4 + 7 = 11.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: First and Last Character Next: Binary to Decimal