Note that i assing the values to a persist in bge.logic attribute, also if you have 2 messages sensor waiting for the same subject you will recive always the same value, to have 2 inputs you need that only 1 state active as input so in state_1 only text_1 has a keyboard sensor and text_2 has no sensors while in state 2 the the text_2 has a keyboard sensor ans text_1 has no sensors, to change the state use a keyboard sensor key RETURN
+and controller
+state actuator
to change the states.
Option 1:

from bge import logic
scene = logic.getCurrentScene()
cont = logic.getCurrentController()
if not hasattr(logic,'value1'):
logic.value1 = int(cont.sensors['Message'].bodies[0])
elif not hasattr(logic,'value2'):
logic.value2 = int(cont.sensors['Message.001'].bodies[0])
scene.objects['result']['Text'] = logic.value1 + logic.value2

Option 2: #######################################################

from bge import logic
scene = logic.getCurrentScene()
def waiting_inputs(controller):
if not hasattr(logic,'value1'):
scene.objects['hint']['Text'] = 'Enter value 1:'
input = scene.objects['input']
logic.value1 = int(input['Text'])
input['Text'] = 'Here'
return
elif not hasattr(logic,'value2'):
scene.objects['hint']['Text'] = 'Enter value 2:'
input = scene.objects['input']
logic.value2 = int(input['Text'])
else:
showOutput()
def showOutput():
scene.objects['result']['Text'] = logic.value1 + logic.value2


Option 3: #######################################################
from bge import logic
scene = logic.getCurrentScene()
cont = logic.getCurrentController()
if not hasattr(logic,'value1'):
logic.value1 = int(cont.sensors['Message'].bodies[0])
elif not hasattr(logic,'value2'):
scene.objects['hint']['Text'] = 'Enter value 2:'
logic.value2 = int(cont.sensors['Message'].bodies[0])
scene.objects['result']['Text'] = logic.value1) + logic.value2

