#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <cstring>
#include <cassert>
using namespace std;
const int MAXV = 200; // max 99 zmiennych * 2
vector<int> graph[MAXV], graphRev[MAXV];
bool visited[MAXV];
stack<int> order;
int comp[MAXV];
int litToIndex(int lit) {
int var = abs(lit) - 1;
assert(var >= 0 && var < 99);
return (lit > 0) ? 2 * var : 2 * var + 1;
}
int neg(int x) {
return x ^ 1;
}
void dfs1(int v) {
visited[v] = true;
for (int u : graph[v]) {
if (!visited[u]) dfs1(u);
}
order.push(v);
}
void dfs2(int v, int c) {
comp[v] = c;
for (int u : graphRev[v]) {
if (comp[u] == -1) dfs2(u, c);
}
}
void addImplication(int a, int b) {
graph[a].push_back(b);
graphRev[b].push_back(a);
}
bool solve2SAT(int vars) {
memset(comp, -1, sizeof(comp));
memset(visited, 0, sizeof(visited));
while (!order.empty()) order.pop();
for (int i = 0; i < 2 * vars; i++)
if (!visited[i]) dfs1(i);
int c = 0;
while (!order.empty()) {
int v = order.top();
order.pop();
if (comp[v] == -1) dfs2(v, c++);
}
for (int i = 0; i < vars; i++) {
if (comp[2*i] == comp[2*i + 1]) return false;
}
return true;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string line;
string result;
while (getline(cin, line)) {
if (line.empty()) continue;
for (int i = 0; i < MAXV; i++) {
graph[i].clear();
graphRev[i].clear();
}
int len = (int)line.size();
int vars = 0;
if (len % 8 != 0) {
cerr << "Błędny format wejścia: " << line << "\n";
exit(1);
}
for (int i = 0; i < len; i += 8) {
if (line[i] != '(' || line[i+7] != ')') {
cerr << "Błędny format klauzuli: " << line.substr(i,8) << "\n";
exit(1);
}
int lit1Sign = (line[i+1] == '+') ? 1 : (line[i+1] == '-') ? -1 : 0;
int lit1Num = (line[i+2]-'0')*10 + (line[i+3]-'0');
int lit2Sign = (line[i+4] == '+') ? 1 : (line[i+4] == '-') ? -1 : 0;
int lit2Num = (line[i+5]-'0')*10 + (line[i+6]-'0');
if (lit1Sign == 0 || lit2Sign == 0) {
cerr << "Nieprawidłowy znak +/- w klauzuli: " << line.substr(i,8) << "\n";
exit(1);
}
if (lit1Num < 1 || lit1Num > 99 || lit2Num < 1 || lit2Num > 99) {
cerr << "Nieprawidłowy numer zmiennej: " << lit1Num << " lub " << lit2Num << "\n";
exit(1);
}
int a = litToIndex(lit1Sign * lit1Num);
int b = litToIndex(lit2Sign * lit2Num);
vars = max(vars, max(lit1Num, lit2Num));
addImplication(neg(a), b);
addImplication(neg(b), a);
}
bool sat = solve2SAT(vars);
result += sat ? '1' : '0';
}
cout << result << '\n';
return 0;
}