//#include <atcoder/mincostflow>
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using namespace std;
typedef pair<long long,long long> ii;
typedef long long lint;

signed main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false); cin.tie(0);
	
	vector<int> v(4);
	for(int i = 0;i < 4;i++) cin >> v[i];
	
	sort(all(v));
	
	do{
		if(v[0] + v[1] == v[2] + v[3]){
			cout << "Yes\n";
			return 0;
		}
		if(v[0] == v[1] + v[2] + v[3]){
			cout << "Yes\n";
			return 0;
		}
	} while(next_permutation(all(v)));
	
	cout << "No\n";
}


#include<bits/stdc++.h>
#define ll long long 
#define mp make_pair 
#define f(i,n) for(int i=0;i<n;i++) 
#define F first 
#define S second 
#define pb push_back 

using namespace std;

void test(){
	string s;
	cin>>s;
	int a[3]={0};
	int n = s.length();
	int sum = 0;
	f(i,n){
		int x = s[i]-'0';
		a[x%3]++;
		sum = sum + x;
	}
	sum = sum%3;
	if(sum==0)
		cout<<"0\n";
	else if(n==1)
		cout<<"-1\n";
	else if(sum==1){
		if(a[1]>0){
			cout<<"1\n";
		}else{
			if(a[0]>0 or a[2]>2){
				cout<<"2\n";
			}else
				cout<<"-1\n";
		}
	}else{
		if(a[2]>0){
			cout<<"1\n";
		}else {
			if(a[0]>0 or a[1]>2){
				cout<<"2\n";
			}else
				cout<<"-1\n";
		}
	}
	
}

int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tests=1;
	// cin>>tests;
	while(tests--){
		test();
	}
}
