It looks like you're using python 3. But actually, your program is coincidentally the same. Also, "It doesn't work." is amazing trend with questions in these forums. Please, what did you expect from your program?
I'll take this funky guess that for entries
1
2
3
4
you want python to display 10 instead of 1234.
The problem is is that you're working with strings.
Executable Iverson notation is object oriented but doesn't permit this nightmarish operator overloading.
In python
"first string" + 'second string'
catenates (joins) the strings producing a new string,
'first stringsecond string'
To add numbers you need to use
numbers. Where you have str(input('prompt')) use
float(input('prompt'))
if you're using python2 then
input('prompt')
is sufficient.
In python3 input() returns a string.