New Number System

A new k – base number system using the symbols 0, 1, 2, ..., k-1 is developed. Each number in the k-base number system is separated by a comma. Let a1,a2,a3 be a number in k-base number system where ai f ε {0, 1, 2, ..., k-1} then value of the number in decimal number system is a3*k2+a2*k1+a1*k0. In a 18-based number system, value of the number 16, 17, 15 is 15*182+17*181+15*180. Given two numbers in k-base number system, write a code to print the sum of the numbers in k-base system.

Note:

Use atoi for string to integer convesion. Refer the below code for reference

#include

using namespace std;

int main ()

{

char s[100];

cin>>s;

int i=atoi(s);

cout

}

Input Format

First line contains the base of number system, k

Next line contains the number n1 in k-base number system

Next line contains the number n2 in k-base number system

Output Format

Print the sum of n1 and n2 in k-base number system




Run code  Save code  Pause Test