#include <bits/stdc++.h>
using namespace std;
#define ll long long int
//#define f(i,a,n) for(ll i=a;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll isPrime(int n) 
{ 
	// Corner cases 
	if (n <= 1) 
		return 1; 
	if (n <= 3) 
		return 2; 

	// This is checked so that we can skip 
	// middle five numbers in below loop 
	if (n % 2 == 0 || n % 3 == 0) 
		return 1; 

	for (int i = 5; i * i <= n; i = i + 6) 
		if (n % i == 0 || n % (i + 2) == 0) 
			return 1; 

	return 2; 
} 

ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i,res%=1000000007; 
    return res; } 
 
 int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
 
ll findlcm(ll arr[], int n) 
{ 
   
    ll ans = arr[0]; 
  
    
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
 
 
int main() 
{
    fast;
    ll t=1;
    //cin>>t;
    while(t--)
    {
      double r,g;
      cin>>r>>g;
      cout<<2*g-r;
      
    } 
    return 0;
}

#include<iostream>
#include<vector>
using namespace std;

int main() {
    int n, m, s, c;
    int ans = 0;
    vector<int> a(5, -1);

    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> s >> c;

        if (s == 1 && c == 0 && n != 1) ans = -1;
        
        if (a[s] == -1 || a[s] == c) a[s] = c;
        else ans = -1;
    }

    if (ans == -1) cout << ans << endl;
    else {
        if (a[1] == -1 && n != 1) a[1] = 1;
        for(int i = 1; i <= n; i++) {
            if (a[i] == -1) a[i] = 0;
            cout << a[i];
        }
        cout << endl;
    }
}