#include <iostream>
#include <limits>
using namespace std;

int main() 
{
	float a, s{};
	
	bool p{};
	
	while((p = static_cast<bool>(std::cin >> a)) && a!=0) s+=a;
	std::cout << "a = " << a << "\tsum = " << s << '\n';
	
	if(!p)
	{
		std::cout << "Input error. Repeat:> ";
		
		std::cin.clear();
		
		// clear till next possible number:
		//while(!std::isspace(std::cin.get()));
		
		// clear till end of string:
		//while(std::cin.get() != '\n');
		
		// clear till end of string (variant 2):
		//std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
	
		// should be same as previous, but it's not:
		std::cin.ignore(std::cin.rdbuf()->in_avail());		// why 0?
	
		// syncronize i. e. drop till next possible number  
		//std::cin.sync();
		
		std::cin >> a;	s+=a;
		std::cout << "a = " << a << "\tsum = " << s << '\n';
	}
	
	return 0;
}