Ruby 1.9: 34 characters

eval(gets.scan(/(?:^| )(\d+)/)*?+)

Aaron out