public int sqrt(int x) {
		if (x <= 0)
			return 0;
		int k = 0;
		int o = x;
		int base = 5;
		while (x >= 1) {
			++k;
			x /= base;
		}
		int p;
		if((k & 1) == 1){
			p = k / 2;
		}else{
			p = k/2 -1;
		}

		int q = k - p;
		for (int i = pow(p,base); i <= pow(q,base); ++i) {
			if (i * i <= o && (i + 1) * (i + 1) > o) {
				return i;
			}
		}
		return p;
	}