class Solution { public long solution(long n) { long answer = -1, number = 0; for(long i = 0; i <= n; i++) { if(i * i == n && i == i) { number = i; break; } } if(number > 0) { answer = (number + 1) * (number + 1); } return answer; } }