///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s,s1;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0,cnt1=0,cnt2=0,flag2=0,allok=0;
        stack<long>stk;
        l=s.size();
        s1=s;
        reverse(s1.begin(),s1.end());
        rep(i,l)
        {
            if(s1[i]=='#')allok=1;
            else if(allok==0)
            {
                if(s1[i]==')')cnt1++;
                else cnt2++;
                if(cnt2>cnt1)flag2=1;
            }
            if(s[i]=='#')
            {
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    flag=0;
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        if(flag==0&&stk.size()!=0&&flag2==0)
        {
            if(stk.size()>cnt)
            {
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(i==p)cout<<stk.size()-cnt+1<<endl;
                        else
                        cout<<1<<endl;
                    }
                }
            }
            else
            {
                p=cnt-stk.size();
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(p>=0)cout<<1<<endl;
                        else
                        cout<<-1<<endl;
                        p++;
                    }
                }
            }
        }
        else
        {
            cout<<-1<<endl;
        }
    }
    return 0;
}


///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0;
        stack<long>stk;
        l=s.size();
        rep(i,l)
        {
            if(s[i]=='#')
            {
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        if(flag==0&&stk.size()!=0)
        {
            if(stk.size()>cnt)
            {
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(i==p)cout<<stk.size()-cnt+1<<endl;
                        else
                        cout<<1<<endl;
                    }
                }
            }
            else
            {
                p=cnt-stk.size();
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(p>=0)cout<<1<<endl;
                        else
                        cout<<-1<<endl;
                        p++;
                    }
                }
            }
        }
        else
        {
            rep(i,l)
            if(s[i]=='#')cout<<-1<<endl;
        }
    }
    return 0;
}


///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0;
        stack<long>stk;
        l=s.size();
        rep(i,l)
        {
            if(s[i]=='#')
            {
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    flag=0;
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        if(flag==0&&stk.size()!=0)
        {
            rep(i,l)
            {
                if(i==p)cout<<stk.size()<<endl;
                else if(s[i]=='#')cout<<-1<<endl;
            }
        }
        else
        {
            rep(i,l)
            if(s[i]=='#')cout<<-1<<endl;
        }
    }
    return 0;
}


///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s,s1;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0,cnt1=0,cnt2=0,flag2=0,allok=0;
        stack<long>stk;
        l=s.size();
        s1=s;
        reverse(s1.begin(),s1.end());
        rep(i,l)
        {
            if(s1[i]=='#')allok=1;
            else if(allok==0)
            {
                if(s[i]==')')cnt1++;
                else cnt2++;
                if(cnt2>cnt1)flag2=1;
            }
            if(s[i]=='#')
            {
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    flag=0;
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        if(flag==0&&stk.size()!=0||flag2==0)
        {
            if(stk.size()>cnt)
            {
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(i==p)cout<<stk.size()-cnt+1<<endl;
                        else
                        cout<<1<<endl;
                    }
                }
            }
            else
            {
                p=cnt-stk.size();
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(p>=0)cout<<1<<endl;
                        else
                        cout<<-1<<endl;
                        p++;
                    }
                }
            }
        }
        else
        {
            rep(i,l)
            if(s[i]=='#')cout<<-1<<endl;
        }
    }
    return 0;
}


///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s,s1;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0,cnt1=0,cnt2=0,flag2=0,allok=0;
        stack<long>stk;
        l=s.size();
        s1=s;
        reverse(s1.begin(),s1.end());
        rep(i,l)
        {
            if(s1[i]=='#')allok=1;
            else if(allok==0)
            {
                if(s1[i]==')')cnt1++;
                else cnt2++;
                if(cnt2>cnt1)flag2=1;
            }
            if(s[i]=='#')
            {
                if(stk.size()==0)flag2=1;
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    flag=0;
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        //cout<<stk.size()<<" "<<cnt<<endl;
        if(s[0]!='('||stk.size()<cnt)flag2=1;
        if(flag==0&&stk.size()!=0&&flag2==0)
        {
            if(stk.size()>=cnt)
            {
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(i==p)cout<<stk.size()-cnt+1<<endl;
                        else
                        cout<<1<<endl;
                    }
                }
            }
        }
        else
        {
            cout<<-1<<endl;
        }
    }
    return 0;
}


///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s,s1;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0,cnt1=0,cnt2=0,flag2=0,allok=0;
        stack<long>stk;
        l=s.size();
        s1=s;
        reverse(s1.begin(),s1.end());
        rep(i,l)
        {
            if(s1[i]=='#')allok=1;
            else if(allok==0)
            {
                if(s1[i]==')')cnt1++;
                else cnt2++;
                if(cnt2>cnt1)flag2=1;
            }
            if(s[i]=='#')
            {
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    flag=0;
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        if(s[0]!='('||stk.size()<cnt)flag2=1;
        if(flag==0&&stk.size()!=0&&flag2==0)
        {
            if(stk.size()>=cnt)
            {
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(i==p)cout<<stk.size()-cnt+1<<endl;
                        else
                        cout<<1<<endl;
                    }
                }
            }
        }
        else
        {
            cout<<-1<<endl;
        }
    }
    return 0;
}


///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s,s1;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0,cnt1=0,cnt2=0,flag2=0,allok=0;
        stack<long>stk;
        l=s.size();
        s1=s;
        reverse(s1.begin(),s1.end());
        rep(i,l)
        {
            if(s1[i]=='#')allok=1;
            else if(allok==0)
            {
                if(s1[i]==')')cnt1++;
                else cnt2++;
                if(cnt2>cnt1)flag2=1;
            }
            if(s[i]=='#')
            {
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    flag=0;
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        if(s[0]!='(')flag2=1;
        if(flag==0&&stk.size()!=0&&flag2==0)
        {
            if(stk.size()>cnt)
            {
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(i==p)cout<<stk.size()-cnt+1<<endl;
                        else
                        cout<<1<<endl;
                    }
                }
            }
            else
            {
                p=cnt-stk.size();
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(p>=0)cout<<1<<endl;
                        else
                        cout<<-1<<endl;
                        p++;
                    }
                }
            }
        }
        else
        {
            cout<<-1<<endl;
        }
    }
    return 0;
}


///....................SUBRATO MOLLICK....................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///........................BETCH-10.......................///
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#define REP2(i,n) for(__typeof(n) i=1; i<=(n); i++)
#define FOR(i,a,b) for(__typeof(b) i=(a); i<=(b); i++)
#define INF (1<<30)
#define PI 3.14159265358979323846264338327950
#define pb(x) push_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ size()
#define eps 1e-9
#define VI vector<int>
#define VS vector<string>
#define LL long long
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define CLEAR(x) memset(x,0,sizeof(x));
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define all(x) x.begin(),x.end()

/*long long c[201]={0};
bool p[205]={0};
void sieve()
{
   long long i,j;
    j=4;
     while(j<=201)
     {
         p[j]=1;
         j+=2;
     }
     long k=1;
     for(i=3;i<=(201);i+=2)
     {
        if(p[i]==0)
        {
            j=i;
            while(j+i<=201)
            {
                p[j+i]=1;j+=i;
            }
            if(p[i+2]==0)
            c[k++]=i;
        }
    }
}*/
/*long long npr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   ret*=(n-i+1);
   return ret;
}*/
/*long long ncr(long n,long m)
{
   long long ret=1,i;
   for(i=1;i<=m;i++)
   {
       ret*=(n-i+1);
       ret/=i;
   }
   return ret;
}*/
/*long long fact(long n)
{
    long long ret=1,i;
    for(i=1;i<=n;i++)
    ret*=i;
    return ret;
}*/
/*long long gcd(long n,long m)
{
  while(m>0)
  {
    n=n%m;
    n=n^m;
    m=m^n;
    n=n^m;
  }
  return n;
}*/
/*long long lcm(long n,long m)
{
    long long x=(n*m)/gcd(n,m);
    return x;
}*/
/*long is_prime(long n)
{
	long long ii;
	if(n == 1)
	return 0;
	if(n == 2)
	return 1;
	if(n%2 == 0)
	return 0;
	for(ii=3;ii*ii<=n;ii=ii+2)
        if(n%ii == 0)
        return 0;
        return 1;
}*/
/*double area_triangle(double x1,double y1,double x2,double y2,double x3,double y3)
{
    double a;
    a=x1*(y2-y3)+y1*(x3-x2)+((x2*y3)-(y2*x3))+eps;
    a=a/2+eps;
    return a;
}*/
/*double dist_2point(double x1,double y1,double x2,double y2)
{
    double d;
    d=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)));
    return d;
}*/
/*int binary_search(int a[],int n,int l,int u)
{
	int mid;
	if(l>u)
    return 0;
    mid=floor(l+u)/2;
    if(a[mid]==n)
    return mid;
    else if(a[mid]>n)
    binary_search(a,n,l,mid-1);
    else
    binary_search(a,n,mid+1,u);
}*/
/*bool is_palindrome(const string &s, int start, int end)
{
    int siz=end-start+1;
    if(siz%2==0)
    {
        int middle=start+siz/2;
        int i;
        for(i =0;middle-1-i>=0&&middle+i<=end&&s[middle-1-i]==s[middle+i];i++);
        if(middle-i-1<0||middle+i>end)
        return true;
    }
    else
    {
        int middle = start + siz/2;
        int i;
        for (i=1;middle-i>=0&&middle+i<=end&&s[middle-i]==s[middle+i];i++);
        if (middle-i<0||middle+i>end)
        return true;
    }
    return false;
}*/
int main()
{
    string s,s1;
    while(cin>>s)
    {
        long l,cnt=0,p,flag=0,cnt1=0,cnt2=0,flag2=0,allok=0;
        stack<long>stk;
        l=s.size();
        s1=s;
        reverse(s1.begin(),s1.end());
        rep(i,l)
        {
            if(s1[i]=='#')allok=1;
            else if(allok==0)
            {
                if(s[i]==')')cnt1++;
                else cnt2++;
                if(cnt2>cnt1)flag2=1;
            }
            if(s[i]=='#')
            {
                cnt++;
                p=i;
                flag=0;
            }
            else
            {
                if(s[i]=='(')
                {
                    stk.push(s[i]);
                    flag=1;
                }
                else
                {
                    flag=0;
                    if(stk.size()!=0)
                    {
                        stk.pop();
                    }
                }
            }
        }
        if(flag==0&&stk.size()!=0&&flag2==0)
        {
            if(stk.size()>cnt)
            {
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(i==p)cout<<stk.size()-cnt+1<<endl;
                        else
                        cout<<1<<endl;
                    }
                }
            }
            else
            {
                p=cnt-stk.size();
                rep(i,l)
                {
                    if(s[i]=='#')
                    {
                        if(p>=0)cout<<1<<endl;
                        else
                        cout<<-1<<endl;
                        p++;
                    }
                }
            }
        }
        else
        {
            rep(i,l)
            if(s[i]=='#')cout<<-1<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	string kalimat;
	cin>>kalimat;
	int le=kalimat.length();
	int cntpgr=0,cnt=0;
	queue<int> q;
	for (int i=le-1; i>=0; i--) {
		if (kalimat[i]=='(') {
			printf("-1\n");
			return 0;
		}
		if (kalimat[i]=='#' ||kalimat[i]==')') {
			break;
		}
	}
	for (int i=0;i<le; i++) {
		if (kalimat[i]=='#') cntpgr++;
		if (kalimat[i]=='(') cnt++;
		if (kalimat[i]==')') cnt--;
		if (cnt-cntpgr<0) {
			printf("-1\n");
			return 0;
		}
	}
	if (cnt<=0) {
		printf("-1\n");
		return 0;
	}
	int cnts=0;
	for (int i=0; i<le; i++) {
		if (kalimat[i]=='(') cnts++;
		if (kalimat[i]==')') cnts--;
		if (kalimat[i]=='#') {
			if (cnts==0) {
				printf("-1\n");
				return 0;
			}if (cntpgr==1) {
				q.push(cnt);
				cnt--;
			} else 	if (cnts>0) {
				q.push(1);
				cnt--;
				cntpgr--;
			}
		}
	}
	while(!q.empty()) {
		cout<<q.front()<<endl;
		q.pop();
	}
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	string kalimat;
	cin>>kalimat;
	int le=kalimat.length();
	int cntpgr=0,cnt=0;
	queue<int> q;
	for (int i=le-1; i>=0; i--) {
		if (kalimat[i]=='(') {
			printf("-1\n");
			return 0;
		}
		if (kalimat[i]=='#' ||kalimat[i]==')') {
			break;
		}
	}
	int lastpgr=-1;
	for (int i=0;i<le; i++) {
		if (kalimat[i]=='#') {
			lastpgr=i;
			cntpgr++;
		}
		if (kalimat[i]=='(') cnt++;
		if (kalimat[i]==')') cnt--;
		if (cnt-cntpgr<0) {
			printf("-1\n");
			return 0;
		}
	}
	if (lastpgr!=-1) {
		int cntsem=0;
		for (int i=lastpgr+1; i<le; i++) {
			if (kalimat[i]=='(') cntsem++;
			if (kalimat[i]==')') cntsem--;
		}
		if (cntsem>0) {
			printf("-1\n"); return 0;
		}
	}
	if (cnt<=0) {
		printf("-1\n");
		return 0;
	}
	int cnts=0;
	for (int i=0; i<le; i++) {
		if (kalimat[i]=='(') cnts++;
		if (kalimat[i]==')') cnts--;
		if (kalimat[i]=='#') {
			if (cnts==0) {
				printf("-1\n");
				return 0;
			}if (cntpgr==1) {
				q.push(cnt);
				cnt--;
			} else 	if (cnts>0) {
				q.push(1);
				cnt--;
				cntpgr--;
			}
		}
	}
	while(!q.empty()) {
		cout<<q.front()<<endl;
		q.pop();
	}
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	string kalimat;
	cin>>kalimat;
	int le=kalimat.length();
	int cntpgr=0,cnt=0;
	queue<int> q;
	for (int i=le-1; i>=0; i--) {
		if (kalimat[i]=='(') {
			printf("-1\n");
			return 0;
		}
		if (kalimat[i]=='#' ||kalimat[i]==')') {
			break;
		}
	}
	int lastpgr=-1;
	for (int i=0;i<le; i++) {
		if (kalimat[i]=='#') {
			lastpgr=i;
			cntpgr++;
		}
		if (kalimat[i]=='(') cnt++;
		if (kalimat[i]==')') cnt--;
		if (cnt-cntpgr<0) {
			printf("-1\n");
			return 0;
		}
	}
	if (lastpgr!=-1) {
		int cntsem=0;
		for (int i=lastpgr+1; i<le; i++) {
			if (kalimat[i]=='(') cntsem++;
			if (kalimat[i]==')') cntsem--;
			if (cntsem<0) {
				printf("-1\n"); return 0;
			}
		}
		if (cntsem!=0) {
			printf("-1\n"); return 0;
		}
	}
	if (cnt<=0) {
		printf("-1\n");
		return 0;
	}
	int cnts=0;
	for (int i=0; i<le; i++) {
		if (kalimat[i]=='(') cnts++;
		if (kalimat[i]==')') cnts--;
		if (kalimat[i]=='#') {
			if (cnts==0) {
				printf("-1\n");
				return 0;
			}if (cntpgr==1) {
				q.push(cnt);
				cnt--;
			} else 	if (cnts>0) {
				q.push(1);
				cnt--;
				cntpgr--;
			}
		}
	}
	while(!q.empty()) {
		cout<<q.front()<<endl;
		q.pop();
	}
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	string kalimat;
	cin>>kalimat;
	int le=kalimat.length();
	int cntpgr=0,cnt=0;
	queue<int> q;
	for (int i=le-1; i>=0; i--) {
		if (kalimat[i]=='(') {
			printf("-1\n");
			return 0;
		}
		if (kalimat[i]=='#' ||kalimat[i]==')') {
			break;
		}
	}
	for (int i=0;i<le; i++) {
		if (kalimat[i]=='#') cntpgr++;
		if (kalimat[i]=='(') cnt++;
		if (kalimat[i]==')') cnt--;
		if (cnt<0) {
			printf("-1\n");
			return 0;
		}
	}
	if (cnt==0) {
		printf("-1\n");
		return 0;
	}
	int cnts=0;
	for (int i=0; i<le; i++) {
		if (kalimat[i]=='(') cnts++;
		if (kalimat[i]==')') cnts--;
		if (kalimat[i]=='#') {
			if (cnts==0) {
				printf("-1\n");
				return 0;
			}if (cntpgr==1) {
				q.push(cnt);
				cnt--;
			} else 	if (cnts>0) {
				q.push(1);
				cnt--;
				cntpgr--;
			}
		}
	}
	while(!q.empty()) {
		cout<<q.front()<<endl;
		q.pop();
	}
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	string kalimat;
	cin>>kalimat;
	int le=kalimat.length();
	int cntpgr=0,cnt=0;
	queue<int> q;
	for (int i=0;i<le; i++) {
		if (kalimat[i]=='#') cntpgr++;
		if (kalimat[i]=='(') cnt++;
		if (kalimat[i]==')') cnt--;
		if (cnt<0) {
			printf("-1\n");
			return 0;
		}
	}
	if (cnt==0) {
		printf("-1\n");
		return 0;
	}
	int cnts=0;
	for (int i=0; i<le; i++) {
		if (kalimat[i]=='(') cnts++;
		if (kalimat[i]==')') cnts--;
		if (kalimat[i]=='#') {
			if (cnts==0) {
				printf("-1\n");
				return 0;
			}if (cntpgr==1) {
				q.push(cnt);
				cnt--;
			} else 	if (cnts>0) {
				q.push(1);
				cnt--;
				cntpgr--;
			}
		}
	}
	while(!q.empty()) {
		cout<<q.front()<<endl;
		q.pop();
	}
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	string kalimat;
	cin>>kalimat;
	int le=kalimat.length();
	int cntpgr=0,cnt=0;
	queue<int> q;
	for (int i=0;i<le; i++) {
		if (kalimat[i]=='#') cntpgr++;
		if (kalimat[i]=='(') cnt++;
		if (kalimat[i]==')') cnt--;
	}
	if (cnt==0) {
		printf("-1\n");
		return 0;
	}
	int cnts=0;
	for (int i=0; i<le; i++) {
		if (kalimat[i]=='(') cnts++;
		if (kalimat[i]==')') cnts--;
		if (kalimat[i]=='#') {
			if (cnts==0) {
				printf("-1\n");
				return 0;
			}if (cntpgr==1) {
				q.push(cnt);
				cnt--;
			} else 	if (cnts>0) {
				q.push(1);
				cnt--;
				cntpgr--;
			}
		}
	}
	while(!q.empty()) {
		cout<<q.front()<<endl;
		q.pop();
	}
}


#include<bits/stdc++.h>
using namespace std;

int main() {
	string kalimat;
	cin>>kalimat;
	int le=kalimat.length();
	int cntpgr=0,cnt=0;
	queue<int> q;
	for (int i=le-1; i>=0; i--) {
		if (kalimat[i]=='(') {
			printf("-1\n");
			return 0;
		}
		if (kalimat[i]=='#' ||kalimat[i]==')') {
			break;
		}
	}
	for (int i=0;i<le; i++) {
		if (kalimat[i]=='#') cntpgr++;
		if (kalimat[i]=='(') cnt++;
		if (kalimat[i]==')') cnt--;
		if (cnt-cntpgr<0) {
			printf("-1\n");
			return 0;
		}
	}
	if (cnt==0) {
		printf("-1\n");
		return 0;
	}
	int cnts=0;
	for (int i=0; i<le; i++) {
		if (kalimat[i]=='(') cnts++;
		if (kalimat[i]==')') cnts--;
		if (kalimat[i]=='#') {
			if (cnts==0) {
				printf("-1\n");
				return 0;
			}if (cntpgr==1) {
				q.push(cnt);
				cnt--;
			} else 	if (cnts>0) {
				q.push(1);
				cnt--;
				cntpgr--;
			}
		}
	}
	while(!q.empty()) {
		cout<<q.front()<<endl;
		q.pop();
	}
}


#include <cstdio>
#include <string.h>
using namespace std;
const int NMax=1010000;
int N;
char A[NMax];
int l;
int S[NMax],len[NMax],ans[NMax];
int main()
{
	scanf("%s",A);
	N=strlen(A);
	int p=0;
	for(int i=0;i<N;i++) {
		if(A[i]=='('){
			S[l++]=-1;
		}else if(A[i]==')') {
			if(l&&S[l-1]==-1) {
				l--;
			}else S[l++]=-2;
		}else {
			if(l&&S[l-1]==-1) l--;
			else S[l++]=-2;
			S[l++]=(p++);
		}
	}
	if(S[0]==-2||S[l-1]==-1) {
		puts("-1");
		getchar();getchar();
		return 0;
	}
	int tmp=0;
	for(int i=0;i<l;i++) {
		if(S[i]==-1) tmp++;
		if(S[i]==-2) tmp--;
		len[i]=tmp;
		if(tmp<0) {
			puts("-1");
			getchar();getchar();
			return 0;
		}
	}
	//for(int i=0;i<l;i++) printf("%d ",S[i]);puts("");
	int left=0;
	for(int i=l-1;i>=0;i--) {
		if(S[i]>=0){
			if(i>0){
				ans[S[i]]=len[i-1]-left;
				break;
			}
			left+=len[i-1]-left;
		}
		if(S[i]==-1) left--;
		if(S[i]==-2) left++;
	}
	for(int i=0;i<p;i++) printf("%d\n",ans[i]+1);
	getchar();getchar();
	return 0;
}


#include <cstdio>
#include <string.h>
using namespace std;
const int NMax=110000;
int N;
char A[NMax];
int l;
int S[NMax],len[NMax],ans[NMax];
int main()
{
	scanf("%s",A);
	N=strlen(A);
	int p=0;
	for(int i=0;i<N;i++) {
		if(A[i]=='('){
			S[l++]=-1;
		}else if(A[i]==')') {
			if(l&&S[l-1]==-1) {
				while(l&&S[l-1]==-1)l--;
			}else S[l++]=-2;
		}else {
			if(l&&S[l-1]==-1) l--;
			else S[l++]=-2;
			S[l++]=(p++);
		}
	}
	if(S[0]==-2||S[l-1]==-1) {
		puts("-1");
		getchar();getchar();
		return 0;
	}
	int tmp=0;
	for(int i=0;i<l;i++) {
		if(S[i]==-1) tmp++;
		if(S[i]==-2) tmp--;
		len[i]=tmp;
		if(tmp<0) {
			puts("-1");
			if(N>100) puts("B");
			getchar();getchar();
			return 0;
		}
	}
	//for(int i=0;i<l;i++) printf("%d ",S[i]);puts("");
	int left=0;
	for(int i=l-1;i>=0;i--) {
		if(S[i]>=0){
			if(i>0)ans[S[i]]=len[i-1]-left;
			left+=len[i-1]-left;
		}
		if(S[i]==-1) left--;
		if(S[i]==-2) left++;
	}
	for(int i=0;i<p;i++) printf("%d\n",ans[i]+1);
	getchar();getchar();
	return 0;
}


#include <cstdio>
#include <string.h>
using namespace std;
const int NMax=110000;
int N;
char A[NMax];
int l;
int S[NMax],len[NMax],ans[NMax];
int main()
{
	scanf("%s",A);
	N=strlen(A);
	int p=0;
	for(int i=0;i<N;i++) {
		if(A[i]=='('){
			S[l++]=-1;
		}else if(A[i]==')') {
			if(l&&S[l-1]==-1) {
				while(l&&S[l-1]==-1)l--;
			}else S[l++]=-2;
		}else {
			if(l&&S[l-1]==-1) l--;
			else S[l++]=-2;
			S[l++]=(p++);
		}
	}
	if(S[0]==-2||S[l-1]==-1) {
		puts("-1");
		getchar();getchar();
		return 0;
	}
	int tmp=0;
	for(int i=0;i<l;i++) {
		if(S[i]==-1) tmp++;
		if(S[i]==-2) tmp--;
		len[i]=tmp;
		if(tmp<0) {
			puts("-1");
			getchar();getchar();
			return 0;
		}
	}
	//for(int i=0;i<l;i++) printf("%d ",S[i]);puts("");
	int left=0;
	for(int i=l-1;i>=0;i--) {
		if(S[i]>=0){
			if(i>0)ans[S[i]]=len[i-1]-left;
			left+=len[i-1]-left;
		}
		if(S[i]==-1) left--;
		if(S[i]==-2) left++;
	}
	for(int i=0;i<p;i++) printf("%d\n",ans[i]+1);
	getchar();getchar();
	return 0;
}


#include <cstdio>
#include <string.h>
using namespace std;
const int NMax=1010000;
int N;
char A[NMax];
int l;
int S[NMax],len[NMax],ans[NMax];
int main()
{
	scanf("%s",A);
	N=strlen(A);
	int p=0;
	for(int i=0;i<N;i++) {
		if(A[i]=='('){
			S[l++]=-1;
		}else if(A[i]==')') {
			if(l&&S[l-1]==-1) {
				while(l&&S[l-1]==-1)l--;
			}else S[l++]=-2;
		}else {
			if(l&&S[l-1]==-1) l--;
			else S[l++]=-2;
			S[l++]=(p++);
		}
	}
	if(S[0]==-2||S[l-1]==-1) {
		puts("-1");
		getchar();getchar();
		return 0;
	}
	int tmp=0;
	for(int i=0;i<l;i++) {
		if(S[i]==-1) tmp++;
		if(S[i]==-2) tmp--;
		len[i]=tmp;
		if(tmp<0) {
			puts("-1");
			getchar();getchar();
			return 0;
		}
	}
	//for(int i=0;i<l;i++) printf("%d ",S[i]);puts("");
	int left=0;
	for(int i=l-1;i>=0;i--) {
		if(S[i]>=0){
			if(i>0)ans[S[i]]=len[i-1]-left;
			left+=len[i-1]-left;
		}
		if(S[i]==-1) left--;
		if(S[i]==-2) left++;
	}
	for(int i=0;i<p;i++) printf("%d\n",ans[i]+1);
	getchar();getchar();
	return 0;
}


#include <cstdio>
#include <string.h>
using namespace std;
const int NMax=1010000;
int N;
char A[NMax];
int l;
int S[NMax],len[NMax],ans[NMax];
int main()
{
	scanf("%s",A);
	N=strlen(A);
	int p=0;
	for(int i=0;i<N;i++) {
		if(A[i]=='('){
			S[l++]=-1;
		}else if(A[i]==')') {
			if(l&&S[l-1]==-1) {
				l--;
			}else S[l++]=-2;
		}else {
			if(l&&S[l-1]==-1) l--;
			else S[l++]=-2;
			S[l++]=(p++);
		}
	}
	if(S[0]==-2||S[l-1]==-1) {
		puts("-1");
		getchar();getchar();
		return 0;
	}
	int tmp=0;
	for(int i=0;i<l;i++) {
		if(S[i]==-1) tmp++;
		if(S[i]==-2) tmp--;
		len[i]=tmp;
		if(tmp<0) {
			puts("-1");
			getchar();getchar();
			return 0;
		}
	}
	//for(int i=0;i<l;i++) printf("%d ",S[i]);puts("");
	int left=0;
	for(int i=l-1;i>=0;i--) {
		if(S[i]>=0){
			if(i>0)ans[S[i]]=len[i-1]-left;
			left+=len[i-1]-left;
		}
		if(S[i]==-1) left--;
		if(S[i]==-2) left++;
	}
	for(int i=0;i<p;i++) printf("%d\n",ans[i]+1);
	getchar();getchar();
	return 0;
}


#include <cstdio>
#include <string.h>
using namespace std;
const int NMax=1010000;
int N;
char A[NMax];
int l;
int S[NMax],len[NMax],ans[NMax];
int main()
{
	scanf("%s",A);
	N=strlen(A);
	int p=0;
	for(int i=0;i<N;i++) {
		if(A[i]=='('){
			S[l++]=-1;
		}else if(A[i]==')') {
			if(l&&S[l-1]==-1) {
				while(l&&S[l-1]==-1)l--;
			}else S[l++]=-2;
		}else {
			if(l&&S[l-1]==-1) l--;
			else S[l++]=-2;
			S[l++]=(p++);
		}
	}
	if(S[0]==-2||S[l-1]==-1) {
		puts("-1");
		if(N>100) {
			printf("%d\n",l);
			printf("l-1:%d\n",S[l-1]);
			printf("0:%d\n",S[0]);
		}
		getchar();getchar();
		return 0;
	}
	int tmp=0;
	for(int i=0;i<l;i++) {
		if(S[i]==-1) tmp++;
		if(S[i]==-2) tmp--;
		len[i]=tmp;
		if(tmp<0) {
			puts("-1");
			getchar();getchar();
			return 0;
		}
	}
	//for(int i=0;i<l;i++) printf("%d ",S[i]);puts("");
	int left=0;
	for(int i=l-1;i>=0;i--) {
		if(S[i]>=0){
			if(i>0)ans[S[i]]=len[i-1]-left;
			left+=len[i-1]-left;
		}
		if(S[i]==-1) left--;
		if(S[i]==-2) left++;
	}
	for(int i=0;i<p;i++) printf("%d\n",ans[i]+1);
	getchar();getchar();
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
char s[100005];
int pp[100005],cnt;
int main(void){
	scanf("%s",s);
	int a=0,b=0;
	cnt=0;
	int i;
	for(i=0;s[i]!='\0';i++){
		if(s[i]=='#'){
		   pp[cnt++]=a-b;
		}
		else if(s[i]=='(') a++;
		else if(s[i]==')') b++;
	}
	int ok=1;
	for(i=0;i<cnt;i++)
	  if(pp[i]<=0) ok=0;
	if(ok==0||a==b||cnt>b-a) printf("-1\n");
	else{
		int sum=0;
		for(i=0;i<cnt-1;i++)
		  printf("1\n"),sum++;
		printf("%d\n",a-b-sum);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
char s[100005];
int main(void){
	scanf("%s",s);
	int i;
	int ok=1;
	int lst=0;
	int rr=0;
	int gg=0;
	int cnt=0;
	int ff=0;
	for(i=0;s[i];i++)
	  if(s[i]=='(') ff++;
	  else ff--;
	ff++;
	for(i=0;s[i];i++)
	  if(s[i]=='#') lst=i,cnt++;
	for(i=0;s[i];i++){
      if(i==lst) gg-=ff;
	  else if(s[i]=='#')  gg--;
	  else if(s[i]=='(') gg++;
	  else if(s[i]==')') gg--;
	  if(gg<0) ok=0;
	}
	if(ok==0||ff<=0) printf("-1\n");
	else{
		for(i=0;i<cnt-1;i++) printf("1\n");
		printf("%d\n",ff);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
char s[100005];
int main(void){
	scanf("%s",s);
	int i;
	int ok=1;
	int lst=0;
	int rr=0;
	int gg=0;
	int cnt=0;
	int ff=0;
	for(i=0;s[i];i++)
	  if(s[i]=='(') ff++;
	  else ff--;
	ff++;
	for(i=0;s[i];i++)
	  if(s[i]=='#') lst=i,cnt++;
	for(i=0;i<s[i];i++){
      if(i==lst) gg-=ff;
	  else if(s[i]=='#')  gg--;
	  else if(s[i]=='(') gg++;
	  else if(s[i]==')') gg--;
	  if(gg<0) ok=0;
	}
	if(ok==0) printf("-1\n");
	else{
		for(i=0;i<cnt-1;i++) printf("1\n");
		printf("%d\n",ff);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
char s[100005];
int pp[100005],cnt;
int main(void){
	scanf("%s",s);
	int a=0,b=0;
	cnt=0;
	int i;
	for(i=0;s[i]!='\0';i++){
		if(s[i]=='#'){
		   pp[cnt++]=a-b;
		}
		else if(s[i]=='(') a++;
		else if(s[i]==')') b++;
	}
	int ok=1;
	for(i=0;i<cnt;i++)
	  if(pp[i]<=0) ok=0;
	if(ok==0||a==b||cnt>a-b) printf("-1\n");
	else{
		int sum=0;
		for(i=0;i<cnt-1;i++)
		  printf("1\n"),sum++;
		printf("%d\n",a-b-sum);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
char s[100005];
int pp[100005],cnt;
int main(void){
	scanf("%s",s);
	int i;
	int a=0,b=0;
	int ok=1;
	int lst=0;
	for(i=0;s[i]!='\0';i++){
		if(s[i]=='#'){
			b++;
			pp[cnt++]=a-b;
		}
		else if(s[i]=='('){
			a++;
			lst=i;
		}
		else if(s[i]==')'){
			b++;
		}
		if(a<b) ok=0;
	}
	int rr=a-b+1;
	if(pp[cnt-1]<rr) ok=0;

	if(ok==0) printf("-1\n");
	else{
		for(i=0;i<cnt-1;i++) printf("1\n");
		printf("%d\n",rr);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
char s[100005];
int main(void){
	scanf("%s",s);
	int i;
	int ok=1;
	int lst=0;
	int rr=0;
	int gg=0;
	int cnt=0;
	int ff=0;
	for(i=0;s[i];i++)
	  if(s[i]=='(') ff++;
	  else ff--;
	ff++;
	for(i=0;s[i];i++)
	  if(s[i]=='#') lst=i,cnt++;
	for(i=0;i<s[i];i++){
      if(i==lst) gg-=ff;
	  else if(s[i]=='#')  gg--;
	  else if(s[i]=='(') gg++;
	  else if(s[i]==')') gg--;
	  if(gg<0) ok=0;
	}
	if(ok==0||ff==0) printf("-1\n");
	else{
		for(i=0;i<cnt-1;i++) printf("1\n");
		printf("%d\n",ff);
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
char s[100005];
int main(void){
	scanf("%s",s);
	int i;
	int ok=1;
	int lst=0;
	int rr=0;
	int gg=0;
	int cnt=0;
	int ff=0;
	for(i=0;s[i];i++)
	  if(s[i]=='(') ff++;
	  else ff--;
	ff++;
	for(i=0;s[i];i++)
	  if(s[i]=='#') lst=i,cnt++;
	for(i=0;i<s[i];i++){
      if(i==lst) gg-=ff;
	  else if(s[i]=='#')  gg--;
	  else if(s[i]=='(') gg++;
	  else if(s[i]==')') gg--;
	  if(gg<0) ok=0;
	}
	if(ok==0||ff<=0) printf("-1\n");
	else{
		for(i=0;i<cnt-1;i++) printf("1\n");
		printf("%d\n",ff);
	}
	return 0;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
vector<int> open;
string in;
vector<ii > ans;
bool componprinted ( const ii& a, const ii& b ) {
	if ( a.first != b.first ) return a.first > b.first;
	return a.second < b.second;
}
bool compsort ( const ii& a, const ii& b ) {
	return a.second < b.second;
}
bool allzeroes() {
	for ( int i = 0 ; i < ans.size() ; i ++ )
		if ( ans[i].first != 0 )
			return false;
	return true;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	bool notbeu = false;
	int lo , lc;
	for ( int i = 1 ; i <= in.length() ; i ++ )
		if ( in[i-1] == '(' ) {
			arr[i] = 1;
			open.pb(i);
			lo = i;
		} else if ( in[i-1] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			} else notbeu = true;
			lc = i;
		} else {
			arr[i] = 2;
			hash ++;
			lc = i;
		}
	if ( notbeu || lo > lc ) {
		cout << -1 << endl;
		return 0;
	}
	int count = 0;
	int printed = 0;
	for ( int i = 1 ; i <= in.length() ; i ++  )
		if ( arr[i] == 1 ) count ++;
		else if ( arr[i] == 2 ) {
			ans.pb(mp(count,printed));
			count = 0;
			printed ++;
		}
	while ( printed < hash ) {
		ans.pb(mp(0,printed));
		printed++;
	}
	if ( allzeroes() ) {
		cout << -1 << endl;
		return 0;
	}
	sort(ans.begin(),ans.end(),componprinted);
	for ( int i = ans.size() - 1 , j = 0 ; j < ans.size() && i >= 0 ;
			i -- ) {
		if ( ans[i].first != 0 ) break;
		if ( ans[j].first <= 1 ) break;
		ans[i].first ++;
		ans[j].first --;
		if ( ans[j].first == 1 ) j ++;
	}
	sort(ans.begin(),ans.end(),compsort);
	for ( int i = 0 ; i < ans.size() ; i ++ ) {
		cout << (ans[i].first == 0 ? -1 : ans[i].first) << endl;
	}
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
vector<int> open;
string in;
vector<ii > ans;
bool componprinted ( const ii& a, const ii& b ) {
	if ( a.first != b.first ) return a.first > b.first;
	return a.second < b.second;
}
bool compsort ( const ii& a, const ii& b ) {
	return a.second < b.second;
}
bool allzeroes() {
	for ( int i = 0 ; i < ans.size() ; i ++ )
		if ( ans[i].first != 0 )
			return false;
	return true;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	for ( int i = 1 ; i <= in.length() ; i ++ )
		if ( in[i-1] == '(' ) {
			arr[i] = 1;
			open.pb(i);
		} else if ( in[i-1] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			}
		} else {
			arr[i] = 2;
			hash ++;
		}
	int count = 0;
	int printed = 0;
	for ( int i = 1 ; i <= in.length() ; i ++  )
		if ( arr[i] == 1 ) count ++;
		else if ( arr[i] == 2 ) {
			ans.pb(mp(count,printed));
			count = 0;
			printed ++;
		}
	while ( printed < hash ) {
		ans.pb(mp(0,printed));
		printed++;
	}
	if ( allzeroes() ) {
		cout << -1 << endl;
		return 0;
	}
	sort(ans.begin(),ans.end(),componprinted);
	for ( int i = ans.size() - 1 , j = 0 ; j < ans.size() && i >= 0 ;
			i -- ) {
		if ( ans[i].first != 0 ) break;
		if ( ans[j].first <= 1 ) break;
		ans[i].first ++;
		ans[j].first --;
		if ( ans[j].first == 1 ) j ++;
	}
	sort(ans.begin(),ans.end(),compsort);
	for ( int i = 0 ; i < ans.size() ; i ++ ) {
		cout << (ans[i].first == 0 ? -1 : ans[i].first) << endl;
	}
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
vector<int> open;
string in;
vector<ii > ans;
bool componprinted ( const ii& a, const ii& b ) {
	if ( a.first != b.first ) return a.first > b.first;
	return a.second < b.second;
}
bool compsort ( const ii& a, const ii& b ) {
	return a.second < b.second;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	for ( int i = 1 ; i <= in.length() ; i ++ )
		if ( in[i-1] == '(' ) {
			arr[i] = 1;
			open.pb(i);
		} else if ( in[i-1] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			}
		} else {
			arr[i] = 2;
			hash ++;
		}
	int count = 0;
	int printed = 0;
	for ( int i = 1 ; i <= in.length() ; i ++  )
		if ( arr[i] == 1 ) count ++;
		else if ( arr[i] == 2 ) {
			ans.pb(mp(count,printed));
			count = 0;
			printed ++;
		}
	while ( printed < hash ) {
		ans.pb(mp(0,printed));
		printed++;
	}
	sort(ans.begin(),ans.end(),componprinted);
	for ( int i = ans.size() - 1 , j = 0 ; j < ans.size() && i >= 0 ;
			i -- ) {
		if ( ans[i].first != 0 ) break;
		if ( ans[j].first <= 1 ) break;
		ans[i].first ++;
		ans[j].first --;
		if ( ans[j].first == 1 ) j ++;
	}
	sort(ans.begin(),ans.end(),compsort);
	for ( int i = 0 ; i < ans.size() ; i ++ ) {
		cout << (ans[i].first == 0 ? -1 : ans[i].first) << endl;
	}
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
vector<int> open;
string in;
vector<ii > ans;
bool componprinted ( const ii& a, const ii& b ) {
	if ( a.first != b.first ) return a.first > b.first;
	return a.second < b.second;
}
bool compsort ( const ii& a, const ii& b ) {
	return a.second < b.second;
}
bool allzeroes() {
	for ( int i = 0 ; i < ans.size() ; i ++ )
		if ( ans[i].first != 0 )
			return false;
	return true;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	bool notbeu = false;
	for ( int i = 1 ; i <= in.length() ; i ++ )
		if ( in[i-1] == '(' ) {
			arr[i] = 1;
			open.pb(i);
		} else if ( in[i-1] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			} else notbeu = true;
		} else {
			arr[i] = 2;
			hash ++;
		}
	if ( notbeu ) {
		cout << -1 << endl;
		return 0;
	}
	int count = 0;
	int printed = 0;
	for ( int i = 1 ; i <= in.length() ; i ++  )
		if ( arr[i] == 1 ) count ++;
		else if ( arr[i] == 2 ) {
			ans.pb(mp(count,printed));
			count = 0;
			printed ++;
		}
	while ( printed < hash ) {
		ans.pb(mp(0,printed));
		printed++;
	}
	if ( allzeroes() ) {
		cout << -1 << endl;
		return 0;
	}
	sort(ans.begin(),ans.end(),componprinted);
	for ( int i = ans.size() - 1 , j = 0 ; j < ans.size() && i >= 0 ;
			i -- ) {
		if ( ans[i].first != 0 ) break;
		if ( ans[j].first <= 1 ) break;
		ans[i].first ++;
		ans[j].first --;
		if ( ans[j].first == 1 ) j ++;
	}
	sort(ans.begin(),ans.end(),compsort);
	for ( int i = 0 ; i < ans.size() ; i ++ ) {
		cout << (ans[i].first == 0 ? -1 : ans[i].first) << endl;
	}
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
int arr2[N];
vector<int> open;
vector<int> reverse_open;
string in;
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	for ( int i = 1 ; i <= in.length() ; i ++ ) {
		if ( in[i-1] == '(' ) {
			arr[i] = 1;
			open.pb(i);
		} else if ( in[i-1] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			}
		} else {
			arr[i] = 2;
			hash ++;
		}
	}
	for ( int i = 1 , j = in.length()-1 ; j>= 0
		; i ++ , j -- ) {
		if ( in[j] == ')' ) {
			arr2[i] = 1;
			reverse_open.pb(i);
		} else if ( in[j] == '(' ) {
			if ( !reverse_open.empty() ) {
				arr2[reverse_open[reverse_open.size()-1]] = 0;
				reverse_open.pop_back();
			}
		} else {
			arr2[i] = 2;
		}
	}
	int count = 0;
	int printed = 0;
	for ( int i = 1 ; i <= in.length() ; i ++  ) {
		if ( arr[i] == 1 ) count ++;
		if ( arr[i] == 2 ) {
			if ( count != 0 )
			cout << count << endl;
			else cout << -1 << endl;
			count = 0;
			printed ++;
		}
	}
	while ( printed < hash ) {
		cout << -1 << endl;
		printed++;
	}
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
vector<int> open;
vector<int> ans;
string in;
bool allzeroes() {
	for ( int i = 0 ; i < ans.size() ; i ++ )
		if ( ans[i] != 0 )
			return false;
	return true;
}
bool check() {
	for ( int i = in.length()-1 ; i >= 0 ; i -- )
		if ( arr[i] == 2 ) return false;
		else if( arr[i] == 1 ) return true;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	for ( int i = 0 ; i < in.length() ; i ++ ) {
		if ( in[i] == '(' ) {
			arr[i] = 1;
			open.push_back(i);
		} else if ( in[i] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			} else {
				cout << -1 << endl;
				return 0;
			}
		} else {
			arr[i] = 2;
			hash ++;
		}
	}
	if ( check() ) {
		cout << -1 << endl;
		return 0;
	}
	int count = 0;
	int printed = 0;
	for ( int i = 0 ; i < in.length() ; i ++ ) {
		if ( arr[i] == 1 ) count ++;
		else if ( arr[i] == 2 ) {
			ans.pb(count);
			count = 0;
			printed ++;
		}
	}
	if ( allzeroes() ) {
		cout << -1 << endl;
		return 0;
	}
	while ( printed < hash ) {
		ans.pb(0);
		printed++;
	}
	for ( int i = 0 ; i < ans.size() ; i ++ )
		cout << ans[i] << endl;
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
vector<int> open;
vector<ii > ans;
bool componprinted ( const ii& a, const ii& b ) {
	if ( a.first != b.first ) return a.first > b.first;
	return a.second < b.second;
}
bool compsort ( const ii& a, const ii& b ) {
	return a.second < b.second;
}
string in;
bool allzeroes() {
	for ( int i = 0 ; i < ans.size() ; i ++ )
		if ( ans[i].first != 0 )
			return false;
	return true;
}
bool check() {
	for ( int i = in.length()-1 ; i >= 0 ; i -- )
		if ( arr[i] == 2 ) return false;
		else if( arr[i] == 1 ) return true;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	for ( int i = 0 ; i < in.length() ; i ++ ) {
		if ( in[i] == '(' ) {
			arr[i] = 1;
			open.push_back(i);
		} else if ( in[i] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			} else {
				cout << -1 << endl;
				return 0;
			}
		} else {
			arr[i] = 2;
			hash ++;
		}
	}
	if ( check() ) {
		cout << -1 << endl;
		return 0;
	}
	int count = 0;
	int printed = 0;
	for ( int i = 0 ; i < in.length() ; i ++  )
			if ( arr[i] == 1 ) count ++;
			else if ( arr[i] == 2 ) {
				ans.pb(mp(count,printed));
				count = 0;
				printed ++;
			}
		while ( printed < hash ) {
			ans.pb(mp(0,printed));
			printed++;
		}
		if ( allzeroes() ) {
			cout << -1 << endl;
			return 0;
		}
		sort(ans.begin(),ans.end(),componprinted);
		for ( int i = ans.size() - 1 , j = 0 ; j < ans.size() && i >= 0 ;
				i -- ) {
			if ( ans[i].first != 0 ) break;
			if ( ans[j].first <= 1 ) break;
			ans[i].first ++;
			ans[j].first --;
			if ( ans[j].first == 1 ) j ++;
		}
		sort(ans.begin(),ans.end(),compsort);
		for ( int i = 0 ; i < ans.size() ; i ++ ) {
			cout << (ans[i].first == 0 ? -1 : ans[i].first) << endl;
		}
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
int arr2[N];
vector<int> open;
vector<int> reverse_open;
string in;
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	for ( int i = 1 ; i <= in.length() ; i ++ ) {
		if ( in[i-1] == '(' ) {
			arr[i] = 1;
			open.pb(i);
		} else if ( in[i-1] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			}
		} else {
			arr[i] = 2;
			hash ++;
		}
	}
	for ( int i = 1 , j = in.length()-1 ; j>= 0
		; i ++ , j -- ) {
		if ( in[j] == ')' ) {
			arr2[i] = 1;
			reverse_open.pb(i);
		} else if ( in[j] == '(' ) {
			if ( !reverse_open.empty() ) {
				arr2[reverse_open[reverse_open.size()-1]] = 0;
				reverse_open.pop_back();
			}
		} else {
			arr2[i] = 2;
		}
	}
	int count = 0;
	int printed = 0;
	for ( int i = 1 ; i <= in.length() ; i ++  ) {
		if ( arr[i] == 1 ) count ++;
		if (arr2[i] == 1) count ++;
		if ( arr[i] == 2 ) {
			if ( count != 0 )
			cout << count << endl;
			else cout << -1 << endl;
			count = 0;
			printed ++;
		}
	}
	while ( printed < hash ) {
		cout << -1 << endl;
		printed++;
	}
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
string in;
int open = 0, idx_last = -1;
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	for ( int i = 0; i < in.length(); i ++ ) {
		open += in[i] == '(' ? 1 : -1;
		if ( in[i] == '#' ) idx_last = i;
	}
	if ( open < 0 ) {
		cout << -1 << endl;
		return 0;
	}
	for( int i = 0 , j = 0 ; i < in.length() ; i ++ ) {
		if ( i == idx_last ) j -= open+1;
		else {
			if ( in[i] == '(' ) j ++;
			else j --;
		}
		if ( j < 0 ) {
			cout << -1 << endl;
			return 0;
		}
	}
	for ( int i = 0 ; i < in.length() ; i ++ )
		if ( in[i] == '#' )
			cout << ( i == idx_last ? open+1 : 1 ) << endl;
	return 0 ;
}


/*
 *  Created on: Dec 13, 2014
 *      Author: Hassan
 */
#include <functional>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <cstdio>
#include <bitset>
#include <cmath>
#include <ctime>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#define MAX_LONG  (1LL<<63)-1
#define MIN_LONG -(1LL<<63)
#define MAX_INT   (1<<31) - 1
#define MIN_INT  -(1<<31)
#define EPS       1e-12
#define MOD       (int)(1e9)+7
#define Inff      (int)(1e8)
#define ii        pair<int,int>
#define vii       vector<pair<int,int> >
#define vi        vector<int>
#define vvi       vector<vector<int> >
#define pb        push_back
#define mp        make_pair
#define ll        long long
using namespace std;
const int N = (int) (1e5) + 7;
int arr[N];
vector<int> open;
string in;
vector<ii > ans;
bool componprinted ( const ii& a, const ii& b ) {
	if ( a.first != b.first ) return a.first > b.first;
	return a.second < b.second;
}
bool compsort ( const ii& a, const ii& b ) {
	return a.second < b.second;
}
bool allzeroes() {
	for ( int i = 0 ; i < ans.size() ; i ++ )
		if ( ans[i].first != 0 )
			return false;
	return true;
}
int main(){
	//freopen("in.txt","r",stdin);
	cin >> in;
	int hash = 0;
	bool notbeu = false , here = false;
	int lo , lc , cnco = 0 , cno = 0;
	for ( int i = 1 ; i <= in.length() ; i ++ )
		if ( in[i-1] == '(' ) {
			arr[i] = 1;
			open.pb(i);
			lo = i;
			cno ++;
		} else if ( in[i-1] == ')' ) {
			if ( !open.empty() ) {
				arr[open[open.size()-1]] = 0;
				open.pop_back();
			} else {
				notbeu = true;
				break;
			}
			lc = i;
			cnco ++;
		} else {
			arr[i] = 2;
			hash ++;
			lc = i;
			here = true;
		}
	if ( notbeu || lo > lc || cnco > cno
			|| (!here && cno != cnco ) ) {
		cout << -1 << endl;
		return 0;
	}
	int count = 0;
	int printed = 0;
	for ( int i = 1 ; i <= in.length() ; i ++  )
		if ( arr[i] == 1 ) count ++;
		else if ( arr[i] == 2 ) {
			ans.pb(mp(count,printed));
			count = 0;
			printed ++;
		}
	while ( printed < hash ) {
		ans.pb(mp(0,printed));
		printed++;
	}
	if ( allzeroes() ) {
		cout << -1 << endl;
		return 0;
	}
	sort(ans.begin(),ans.end(),componprinted);
	for ( int i = ans.size() - 1 , j = 0 ; j < ans.size() && i >= 0 ;
			i -- ) {
		if ( ans[i].first != 0 ) break;
		if ( ans[j].first <= 1 ) break;
		ans[i].first ++;
		ans[j].first --;
		if ( ans[j].first == 1 ) j ++;
	}
	sort(ans.begin(),ans.end(),compsort);
	for ( int i = 0 ; i < ans.size() ; i ++ ) {
		cout << (ans[i].first == 0 ? -1 : ans[i].first) << endl;
	}
	return 0 ;
}


// In The Name Of God :
#include <bits/stdc++.h>
using namespace std ;
#define PB push_back
#define X first
#define Y second
#define S string
#define ALL(a) a . begin ( ) , a . end ( )
#define print(ab) for(int ii=0;ii<ab.size();ii++)cout<<ab[ii]<<" ";
#define print_pair(ab) for(int i=0;i<ab.size();i++)cout<<ab[i].X<< " " << ab[i].Y<<endl ;
#define make_it(h) set<int>::iterator h ;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
//#define cout<< cout<<setprecision ( 25 )<<;
typedef long long ll;
typedef long double ld;
typedef pair < int , int > pii ;
typedef pair < int , pii > piii ;
const int maxn = 5e3 + 4 ;
const int b_n = 1e18 + 1  ;
const ld pi = 3.1415926535897932384626433832795 ;
const int mod = 1e9 + 7 ;
const int base = 173 ;
int hlp , ans ;
S s ;

main ( )
{

  cin >> s ;
  if ( s . find ( '(' ) > s . find ( '#' ) )
    cout << -1 , exit ( 0 ) ;
 for ( int i = 0 ; i < s . size ( ) ; i ++ )
    if ( s [ i ] == '(' )
      hlp ++ ;
    else if ( s [ i ] == ')' )
      hlp -- ;
    else
      ans ++ ;
  if ( ans > hlp || hlp < 0 )
    cout << -1 , exit ( 0 ) ;
  for ( int i = 0 ; i < ans - 1 ; i ++ )
    cout << 1 << endl , hlp -- ;
  cout << hlp << endl ;

}


// In The Name Of God :
#include <bits/stdc++.h>
using namespace std ;
#define PB push_back
#define X first
#define Y second
#define S string
#define ALL(a) a . begin ( ) , a . end ( )
#define print(ab) for(int ii=0;ii<ab.size();ii++)cout<<ab[ii]<<" ";
#define print_pair(ab) for(int i=0;i<ab.size();i++)cout<<ab[i].X<< " " << ab[i].Y<<endl ;
#define make_it(h) set<int>::iterator h ;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
//#define cout<< cout<<setprecision ( 25 )<<;
typedef long long ll;
typedef long double ld;
typedef pair < int , int > pii ;
typedef pair < int , pii > piii ;
const int maxn = 5e3 + 4 ;
const int b_n = 1e18 + 1  ;
const ld pi = 3.1415926535897932384626433832795 ;
const int mod = 1e9 + 7 ;
const int base = 173 ;
int hlp , ans ;
S s ;

main ( )
{

  cin >> s ;
  if ( s . find ( '(' ) > s . find ( '#' ) )
    cout << -1 , exit ( 0 ) ;
 for ( int i = 0 ; i < s . size ( ) ; i ++ )
    if ( s [ i ] == '(' )
      hlp ++ ;
    else if ( s [ i ] == ')' )
      hlp -- ;
    else
      ans ++ ;
 // ************************************
 int a = 0 , b = 0 , c = 0 ;
 for ( int i = 0 ; i < s . size ( ) ; i ++ )
   if ( s [ i ] == '#' )
     a = i ;
 for ( int i = a ; i < s . size ( ) ; i ++ )
   if ( s [ i ] == '(' )
     b ++ ;
   else if ( s [ i ] == ')' )
     c ++ ;
 if ( b > c )
   cout << -1 , exit ( 0 ) ;
 // ************************************
 if ( ans > hlp || hlp < 0 )
    cout << -1 , exit ( 0 ) ;
  for ( int i = 0 ; i < ans - 1 ; i ++ )
    cout << 1 << endl , hlp -- ;
  cout << hlp << endl ;

}


// In The Name Of God :
#include <bits/stdc++.h>
using namespace std ;
#define PB push_back
#define X first
#define Y second
#define S string
#define ALL(a) a . begin ( ) , a . end ( )
#define print(ab) for(int ii=0;ii<ab.size();ii++)cout<<ab[ii]<<" ";
#define print_pair(ab) for(int i=0;i<ab.size();i++)cout<<ab[i].X<< " " << ab[i].Y<<endl ;
#define make_it(h) set<int>::iterator h ;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
//#define cout<< cout<<setprecision ( 25 )<<;
typedef long long ll;
typedef long double ld;
typedef pair < int , int > pii ;
typedef pair < int , pii > piii ;
const int maxn = 5e3 + 4 ;
const int b_n = 1e18 + 1  ;
const ld pi = 3.1415926535897932384626433832795 ;
const int mod = 1e9 + 7 ;
const int base = 173 ;
int hlp , ans ;
S s ;

main ( )
{

  cin >> s ;
  if ( s . find ( '(' ) > s . find ( '#' ) )
    cout << -1 , exit ( 0 ) ;
 for ( int i = 0 ; i < s . size ( ) ; i ++ )
    if ( s [ i ] == '(' )
      hlp ++ ;
    else if ( s [ i ] == ')' )
      hlp -- ;
    else
      ans ++ ;
 int b = 0 , a = 0 ;
 for ( int i = 0 ; i < s . size ( ) ; i ++ )
   if ( s [ i ] == '(' )
     b = i ;
   else if ( s [ i ] == '#' )
     a = i ;
 if ( b > a )
   cout << -1 , exit ( 0 ) ;
 if ( ans > hlp || hlp < 0 )
    cout << -1 , exit ( 0 ) ;
  for ( int i = 0 ; i < ans - 1 ; i ++ )
    cout << 1 << endl , hlp -- ;
  cout << hlp << endl ;

}


// In The Name Of God :
#include <bits/stdc++.h>
using namespace std ;
#define PB push_back
#define X first
#define Y second
#define S string
#define ALL(a) a . begin ( ) , a . end ( )
#define print(ab) for(int ii=0;ii<ab.size();ii++)cout<<ab[ii]<<"\n";
#define print_pair(ab) for(int i=0;i<ab.size();i++)cout<<ab[i].X<< " " << ab[i].Y<<endl ;
#define make_it(h) set<int>::iterator h ;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
//#define cout<< cout<<setprecision ( 25 )<<;
typedef long long ll;
typedef long double ld;
typedef pair < int , int > pii ;
typedef pair < int , pii > piii ;
const int maxn = 5e3 + 4 ;
const int b_n = 1e18 + 1  ;
const ld pi = 3.1415926535897932384626433832795 ;
const int mod = 1e9 + 7 ;
const int base = 173 ;
int n ;
S s ;
vector < int > vc ;

main ( )
{
  cin >> s ;
  int a = 0 , b = 0 , c = 0 ;
  n = s . size ( ) ;
  for ( int i = 0 ; i < n ; i ++ )
    if ( s [ i ] == '(' )
      a ++ ;
    else if ( s [ i ] == ')' )
      b ++ ;
    else
      c ++ ;
  if ( a - b < c )
    cout << -1 , exit ( 0 ) ;
  int hlp = 0 , t = a - b ;
  for ( int i = 0 ; i < n ; i ++ )
    if ( s [ i ] == '#' )
      s [ i ] = ')' , hlp = i , t -- , vc . PB ( 1 ) ;
  S ret , s1 ;
  vc [ vc . size ( ) - 1 ] += t ;
  for ( int i = 0 ; i < t ; i ++ )
    ret . PB ( ')' ) ;
  for ( int i = 0 ; i < hlp ; i ++ )
    s1 . PB ( s [ i ] ) ;
  s1 += ret ;
  for ( int i = hlp ; i < n ; i ++ )
    s1 . PB ( s [ i ] ) ;
  a = 0 , b = 0 ;
  n = s1 . size ( ) ;
  for ( int i = 0 ; i < n ; i ++ )
    if ( b > a )
      cout << -1 , exit ( 0 ) ;
  else if ( s1 [ i ] == '(' )
      a ++ ;
    else
      b ++ ;
  if ( b > a )
    cout << -1 , exit ( 0 ) ;
  print ( vc ) ;
}


// In The Name Of God :
#include <bits/stdc++.h>
using namespace std ;
#define PB push_back
#define X first
#define Y second
#define S string
#define ALL(a) a . begin ( ) , a . end ( )
#define print(ab) for(int ii=0;ii<ab.size();ii++)cout<<ab[ii]<<" ";
#define print_pair(ab) for(int i=0;i<ab.size();i++)cout<<ab[i].X<< " " << ab[i].Y<<endl ;
#define make_it(h) set<int>::iterator h ;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
//#define cout<< cout<<setprecision ( 25 )<<;
typedef long long ll;
typedef long double ld;
typedef pair < int , int > pii ;
typedef pair < int , pii > piii ;
const int maxn = 5e3 + 4 ;
const int b_n = 1e18 + 1  ;
const ld pi = 3.1415926535897932384626433832795 ;
const int mod = 1e9 + 7 ;
const int base = 173 ;
int hlp , ans ;
S s ;

main ( )
{
  cin >> s ;
  for ( int i = 0 ; i < s . size ( ) ; i ++ )
    if ( s [ i ] == '(' )
      hlp ++ ;
    else if ( s [ i ] == ')' )
      hlp -- ;
    else
      ans ++ ;
  if ( ans > hlp || hlp < 0 )
    cout << -1 , exit ( 0 ) ;
  for ( int i = 0 ; i < ans - 1 ; i ++ )
    cout << 1 << endl , hlp -- ;
  cout << hlp << endl ;
}


// In The Name Of God :
#include <bits/stdc++.h>
using namespace std ;
#define PB push_back
#define X first
#define Y second
#define S string
#define ALL(a) a . begin ( ) , a . end ( )
#define print(ab) for(int ii=0;ii<ab.size();ii++)cout<<ab[ii]<<" ";
#define print_pair(ab) for(int i=0;i<ab.size();i++)cout<<ab[i].X<< " " << ab[i].Y<<endl ;
#define make_it(h) set<int>::iterator h ;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
//#define cout<< cout<<setprecision ( 25 )<<;
typedef long long ll;
typedef long double ld;
typedef pair < int , int > pii ;
typedef pair < int , pii > piii ;
const int maxn = 5e3 + 4 ;
const int b_n = 1e18 + 1  ;
const ld pi = 3.1415926535897932384626433832795 ;
const int mod = 1e9 + 7 ;
const int base = 173 ;
int hlp , ans ;
S s ;

main ( )
{

  cin >> s ;
  if ( s . find ( '(' ) > s . find ( '#' ) )
    cout << -1 , exit ( 0 ) ;
 for ( int i = 0 ; i < s . size ( ) ; i ++ )
    if ( s [ i ] == '(' )
      hlp ++ ;
    else if ( s [ i ] == ')' )
      hlp -- ;
    else
      ans ++ ;
 // ************************************
 int a = 0 , b = 0 ;
 for ( int i = 0 ; i < s . size ( ) ; i ++ )
   if ( s [ i ] == '#' )
     a = i ;
 for ( int i = a ; i < s . size ( ) ; i ++ )
   if ( s [ i ] == '(' )
     b ++ ;
   else if ( s [ i ] == ')' )
     b -- ;
 if ( b != 0 )
   cout << -1 , exit ( 0 ) ;
 // ************************************
 if ( ans > hlp || hlp < 0 )
    cout << -1 , exit ( 0 ) ;
  for ( int i = 0 ; i < ans - 1 ; i ++ )
    cout << 1 << endl , hlp -- ;
  cout << hlp << endl ;

}


// In The Name Of God :
#include <bits/stdc++.h>
using namespace std ;
#define PB push_back
#define X first
#define Y second
#define S string
#define ALL(a) a . begin ( ) , a . end ( )
#define print(ab) for(int ii=0;ii<ab.size();ii++)cout<<ab[ii]<<" ";
#define print_pair(ab) for(int i=0;i<ab.size();i++)cout<<ab[i].X<< " " << ab[i].Y<<endl ;
#define make_it(h) set<int>::iterator h ;
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define int long long
//#define cout<< cout<<setprecision ( 25 )<<;
typedef long long ll;
typedef long double ld;
typedef pair < int , int > pii ;
typedef pair < int , pii > piii ;
const int maxn = 5e3 + 4 ;
const int b_n = 1e18 + 1  ;
const ld pi = 3.1415926535897932384626433832795 ;
const int mod = 1e9 + 7 ;
const int base = 173 ;
int hlp , ans ;
S s ;

main ( )
{
  cin >> s ;
  for ( int i = 0 ; i < s . size ( )  ; i ++ )
    if ( s [ i ] == '(' )
      hlp ++ ;
    else if ( s [ i ] == ')' )
      hlp -- ;
    else
      ans ++ ;
  if ( ans > hlp || hlp < 0 )
    cout << -1 , exit ( 0 ) ;
  for ( int i = 0 ; i < hlp - 1 ; i ++ )
    cout << 1 << endl , hlp -- ;
  cout << hlp << endl ;
}


#include<bits/stdc++.h>

using namespace std;

int fre[100010];
int dp[100010];
int arr[100010];

int main()
{
    int n;
    int i,j,k;

    scanf("%d",&n);

    for(i=0;i<n;i++)
        scanf("%d",&arr[i]);

    sort(arr,arr+n,greater<int>());

    for(i=0;i<n;i++)
        fre[arr[i]]++;

    int points=0;

    for(i=0;i<n;i++)
    {
        int t=arr[i];

        if(fre[t]>0)
        {
            if(t*fre[t]>((t-1)*fre[t-1]+(t+1)*fre[t+1]))
            {
                points+=t*fre[t];
                fre[t]=0;
                fre[t-1]=0;
                fre[t+1]=0;
            }
        }
    }

    cout << points<<endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int fre[100010];
int dp[100010];
//int arr[100010];

int main()
{
    int n;
    int i,j,k;

    scanf("%d",&n);
    j=0;
    int m=0;

    for(i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=m;i++)
    {
        if(fre[i]>0)
            dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
        else
            dp[i]=dp[i-1];
    }

    cout << dp[m] << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int fre[100010];
int dp[100010];
int arr[100010];

int main()
{
    int n;
    int i,j,k;

    scanf("%d",&n);
    j=0;
    for(i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);

        if(fre[t]==0)
        {
            arr[j++]=t;
            fre[t]=1;
        }
        else
            fre[t]++;
    }
    n=j;

    sort(arr,arr+n);

    dp[0]=0;
    dp[1]=fre[1];
    int temp=0;
    j=0;

    for(i=0;i<=arr[n-1];i++)
    {
        if(i==0 || i==1)
        {
            if(arr[j]==i)
                j++;
            continue;
        }

        temp=max(temp,dp[i-2]);

        if(i==arr[j])
        {
            j++;
            dp[i]=i*fre[i] + temp;
        }
        else
            dp[i]=temp;

    }
    int ans=0;

    for(i=0;i<n;i++)
        ans=max(ans,dp[arr[i]]);

    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int fre[100010];
int dp[100010];
//int arr[100010];

int main()
{
    int n;
    int i,j,k;

    scanf("%d",&n);
    j=0;
    int m=0;

    for(i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=(m);i++)
    {
        dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
    }

    cout << dp[m] << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long

ll fre[100010]={0};
ll dp[100010]={0};

int main()
{
    ll n;
    ll i,j,k;

    scanf("%lld",&n);
    j=0;
    ll m=0;

    for(i=0;i<n;i++)
    {
        ll t;
        scanf("%lld",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=(m);i++)
    {
        if(fre>0)
            dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
        else
            dp[i]=dp[i-1];
    }

    cout << dp[m] << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long

ll fre[100010]={0};
ll dp[100010]={0};

int main()
{
    ll n;
    ll i,j,k;

    scanf("%lld",&n);
    j=0;
    ll m=0;

    for(i=0;i<n;i++)
    {
        ll t;
        scanf("%lld",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=(m);i++)
    {
        dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
    }

    cout << dp[m] << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long

ll fre[100010]={0};
ll dp[100010]={0};

int main()
{
    ll n;
    ll i,j,k;

    scanf("%d",&n);
    j=0;
    ll m=0;

    for(i=0;i<n;i++)
    {
        ll t;
        scanf("%d",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=(m+1);i++)
    {
        dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
    }

    cout << dp[m+1] << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long

ll fre[100010];
ll dp[100010];
ll arr[100010];

int main()
{
    ll n;
    ll i,j,k;

    scanf("%lld",&n);
    j=0;
    for(i=0;i<n;i++)
    {
        ll t;
        scanf("%lld",&t);

        if(fre[t]==0)
        {
            arr[j++]=t;
            fre[t]=1;
        }
        else
            fre[t]++;
    }
    n=j;

    sort(arr,arr+n);

    dp[0]=0;
    dp[1]=fre[1];
    ll temp=0;
    j=0;

    for(i=0;i<=arr[n-1];i++)
    {
        if(i==0 || i==1)
        {
            if(arr[j]==i)
                j++;
            continue;
        }

        temp=max(temp,dp[i-2]);

        if(i==arr[j])
        {
            j++;
            dp[i]=i*fre[i] + temp;
        }
        else
            dp[i]=temp;

    }
    ll ans=0;

    for(i=0;i<n;i++)
        ans=max(ans,dp[arr[i]]);

    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int fre[100010];
int dp[100010];
int arr[100010];

int main()
{
    int n;
    int i,j,k;

    scanf("%d",&n);

    for(i=0;i<n;i++)
        scanf("%d",&arr[i]);

    sort(arr,arr+n,greater<int>());

    for(i=0;i<n;i++)
        fre[arr[i]]++;

    int points=0;

    for(i=0;i<n;i++)
    {
        int t=arr[i];

        if(fre[t]>0)
        {
            if(t*fre[t]>((t-1)*fre[t-1]+(t+1)*fre[t+1]))
            {
                points+=t*fre[t];
                fre[t]=0;
                fre[t-1]=0;
                fre[t+1]=0;
            }
        }
    }

    for(i=0;i<n;i++)
        if(fre[arr[i]]>0)
        {
            points+=(arr[i]*fre[arr[i]]);
            fre[arr[i]]=0;
            fre[arr[i]+1]=0;
            fre[arr[i]-1]=0;
        }

    cout << points<<endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int fre[100010]={0};
int dp[100010]={0};

int main()
{
    int n;
    int i,j,k;

    scanf("%d",&n);
    j=0;
    int m=0;

    for(i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=(m+1);i++)
    {
        dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
    }

    cout << dp[m+1] << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long

ll fre[100010]={0};
ll dp[100010]={0};

int main()
{
    ll n;
    ll i,j,k;

    scanf("%lld",&n);
    j=0;
    ll m=0;

    for(i=0;i<n;i++)
    {
        ll t;
        scanf("%lld",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=(m+1);i++)
    {
        dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
    }

    cout << dp[m+1] << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long ;

ll fre[100010];
ll dp[100010];
ll arr[100010];

int main()
{
    ll n;
    ll i,j,k;

    scanf("%d",&n);
    j=0;
    for(i=0;i<n;i++)
    {
        ll t;
        scanf("%d",&t);

        if(fre[t]==0)
        {
            arr[j++]=t;
            fre[t]=1;
        }
        else
            fre[t]++;
    }
    n=j;

    sort(arr,arr+n);

    dp[0]=0;
    dp[1]=fre[1];
    ll temp=0;
    j=0;

    for(i=0;i<=arr[n-1];i++)
    {
        if(i==0 || i==1)
        {
            if(arr[j]==i)
                j++;
            continue;
        }

        temp=max(temp,dp[i-2]);

        if(i==arr[j])
        {
            j++;
            dp[i]=i*fre[i] + temp;
        }
        else
            dp[i]=temp;

    }
    ll ans=0;

    for(i=0;i<n;i++)
        ans=max(ans,dp[arr[i]]);

    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int fre[100010];
int dp[100010];
//int arr[100010];

int main()
{
    int n;
    int i,j,k;

    scanf("%d",&n);
    j=0;
    int m=0;

    for(i=0;i<n;i++)
    {
        int t;
        scanf("%d",&t);
        fre[t]+=t;
        m=max(m,t);
    }

    dp[0]=0;
    dp[1]=fre[1];

    for(i=2;i<=(m+1);i++)
    {
        if(fre[i]>0)
            dp[i]=max(fre[i]+dp[i-2],dp[i-1]);
        else
            dp[i]=dp[i-1];
    }

    cout << dp[m+1] << endl;

    return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

long long a[maxn];
long long dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		long long temp;
		scanf("%I64d",&temp);
		a[temp]++;
	}
	for(int i=0;i<maxn;i++){
		dp[i]--;
	}
	printf("%I64d",solve(n));
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

int a[maxn];
long long dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int temp;
		scanf("%d",&temp);
		a[temp]++;
	}
	for(int i=0;i<maxn;i++){
		dp[i]--;
	}
	printf("%I64d",solve(n));
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

int a[maxn];

long long solve(int i, int total){
	if(i<1) return total;
	return max(solve(i-1,total),solve(i-2,total+a[i]*i));
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int temp;
		scanf("%d",&temp);
		a[temp]++;
	}
	printf("%d\n",solve(n,0));
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

int a[maxn];
int dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int temp;
		scanf("%d",&temp);
		a[temp]++;
	}
	for(int i=0;i<maxn;i++){
		dp[i]--;
	}
	cout << solve(n);
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

int a[maxn];
int dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]>0) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
//	return dp[i] =  max(solve(i-1,total),solve(i-2,total+a[i]*i));
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int temp;
		scanf("%d",&temp);
		a[temp]++;
	}
	printf("%I64d\n",solve(n));
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

long long a[maxn];
long long dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		long long temp;
		scanf("%I64d",&temp);
		a[temp]++;
	}
	for(int i=0;i<maxn;i++){
		dp[i]--;
	}
	solve(n);
	cout << dp[n];
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

int a[maxn];
int dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int temp;
		scanf("%d",&temp);
		a[temp]++;
	}
	for(int i=0;i<maxn;i++){
		dp[i]--;
	}
	printf("%I64d\n",solve(n));
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

long long a[maxn];
long long dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		long long temp;
		scanf("%I64d",&temp);
		a[temp]++;
	}
	dp[1]=a[1];
	for(int i=2;i<=maxn;i++){
		dp[i]=max(dp[i-1],dp[i-2]+a[i]*i);
	}
	cout << dp[maxn];
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

long long a[maxn];
long long dp[maxn];

unsigned long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		long long temp;
		scanf("%I64d",&temp);
		a[temp]++;
	}
	for(int i=0;i<maxn;i++){
		dp[i]--;
	}
	printf("%I64d",solve(n));
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

long long a[maxn];
long long dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		long long temp;
		scanf("%I64d",&temp);
		a[temp]++;
	}
	dp[1]=a[1];
	for(int i=2;i<=n;i++){
		dp[i]=max(dp[i-1],dp[i-2]+a[i]*i);
	}
//	solve(n);
	cout << dp[n];
	return 0;
}


#include <bits/stdc++.h>

#define maxn 100005

using namespace std;

long long a[maxn];
long long dp[maxn];

long long solve(int i){
	if(i<1) return 0;
	if(dp[i]!=-1) return dp[i];
	return dp[i] = max(solve(i-1),solve(i-2) +a[i]*i);
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		long long temp;
		scanf("%I64d",&temp);
		a[temp]++;
	}
	for(int i=0;i<maxn;i++){
		dp[i]--;
	}
	cout << solve(n) << endl;
	return 0;
}