#include <bits/stdc++.h>   using namespace std;   long long n;   long long s(long long x) {     long long ans = 0;     while (x) ans += x % 10, x /= 10;     return ans;   }   long long solve(long long x) { return x * x + s(x) * x - n; }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     long long sq = sqrt(n);     int i;     for (i = sq - 1000000; i <= sq + 1000000; i++) {       if (i > 0)         if (solve(i) == 0) {           cout << i <<   n ;           return 0;         }     }     cout << -1 <<   n ;     return 0;   }   