#include <iostream>
using namespace std;
int tong(int a)
{
	int temp, t = 0, dem = 0, c;
	temp = a % 10;
	while (temp)
	{
		for (int i = 2; i <= temp; i++)
		{
			if (temp % i == 0)
			{
				dem++;
				c = temp;
			}
	
		}
		if (dem == 1) t = t + c;
		dem = 0;
		a = a / 10;
		temp = a % 10;
	}
		
	return t;
}
int main()
{
	int a;
	cout << "Nhap a: ";
	cin >> a;
	cout << "Tong cac chu so nguyen to: " << tong(a);
}