# PROBLEM LINK:

* Author:* Arvind

*M.K.Sripriya*

**Editorialist:**# DIFFICULTY:

EASY.

# PREREQUISITES:

None.

# PROBLEM:

Given an integer N, print the sum of all N digit numbers whose sum of the digits at even indices is equal to the sum of the digits at odd indices.

# QUICK EXPLANATION:

One can solve the question by simply comparing the sums of even and odd digits of all N digit numbers. The sum of all the numbers satisfying the condition is printed.

# EXPLANATION:

We are given an integer N as the input.

The sum of all N digit numbers whose sum of even digits is equal to the sum of odd digits can be obtained by going through all the N digit numbers through a loop. The range of all N digit numbers will be 10^{N-1} to 10^N.

We can then compute the sum of even and odd digits of all the numbers in the range and compare them. It the sums of even and odd digits of the number are equal, we add the number to our final result. This sum of all the numbers whose sums of even and odd digits are equal is printed.

# SOLUTIONS:

## Setter's Solution

```
def Sum(n):
sum=0
for x in str(n):
sum+=int(x)
return sum
def largest(n):
lis=[]
for i in range(10**(n-1),10**n):
if(Sum(str(i)[::2])==Sum(str(i)[1::2])):
lis.append(i)
print(sum(lis))
lis=[]
for i in range((int(input()))):
lis.append(int(input()))
for i in range(len(lis)):
largest(lis[i])
```