링크 : https://www.acmicpc.net/problem/2231
/*
문제 : 분해합
링크 : https://www.acmicpc.net/problem/2231
*/
#include <iostream>
#include <vector>
using namespace std;
int main(){
int num;
cin >> num;
for(int i = 0; i < num; i++){
int sum = 0;
string s = to_string(i);
for(int j = 0; j < s.size(); j++)
sum += (s[j] - '0');
sum += i;
if(sum == num) {
cout << i;
return 0;
}
}
cout << 0;
return 0;
}