#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define endl '\n'
#define forn(i, l, n) for (int i = l; i < int(n); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;
string solve(string str, int pos, int test, string ans, stack<char> st)
{
if (pos >= str.length() && test == 0)
return ans;
if (pos >= str.length())
return "";
if (test < 0)
return "";
if (st.empty())
{
ans += "(";
st.push(str[pos]);
test++;
return solve(str, pos + 1, test, ans, st);
}
if (st.top() != str[pos])
{
ans += "(";
st.push(str[pos]);
test++;
return solve(str, pos + 1, test, ans, st);
}
else
{
st.push(str[pos]);
string a = solve(str, pos + 1, test + 1, ans + "(", st);
st.pop();
st.pop();
string b = solve(str, pos + 1, test - 1, ans + ")", st);
if (a.size() || b.size())
{
if (a.size())
return a;
else
return b;
}
else
return "";
}
}
int main() // Ale C.
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("output.txt", "w", stdout);
string str;
cin >> str;
string ans = solve(str, 0, 0, "", stack<char>());
cout << (ans.length() ? ans : "-1");
return 0;
}