#include<bits/stdc++.h>
using namespace std;
struct node{
int a,b;
}s1,s2;
struct ed{
int x,y,z;
};stack<ed>End;
int cmp(char x)
{
if(x=='(')return 0;
if(x=='|')return 1;
if(x=='&')return 2;
}
int head,tail;
char ans[1000010];
stack<char>opt;
stack<node>sum;
stack<int> num;
char s[1000010];
int n;
int main(){
cin>>s;
for(auto now:s)
{
if(now=='1'||now=='0'){
ans[++tail]=now;
}else if(now=='('){
opt.push(now);
}else if(now=='&'||now=='|'){
while(!opt.empty()&&cmp(now)<=cmp(opt.top()))
{
ans[++tail]=opt.top();opt.pop();
}
opt.push(now);
}else if(now==')'){
while(opt.top()!='(')
{
ans[++tail]=opt.top();
opt.pop();
}
opt.pop();
}
}
while(!opt.empty())
{
ans[++tail]=opt.top();
opt.pop();
}
for(head=1;head<=tail;head++)
{
if(ans[head]=='&')
{
ed y=End.top();
End.pop();
ed x=End.top();
End.pop();
End.push((ed){x.x&y.x,x.y+(x.x==0?1:y.y),x.z+(x.x==0?0:y.z)});
}else if(ans[head]=='|'){
ed y=End.top();
End.pop();
ed x=End.top();
End.pop();
End.push((ed){x.x|y.x,x.y+(x.x==1?0:y.y),x.z+(x.x==1?1:y.z)});
}else{
End.push((ed){ans[head]-'0',0,0});
}
}
cout<<End.top().x<<"\n";
cout<<End.top().y<<" "<<End.top().z<<"\n";
return 0;
}