stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

    int a,b;



    cin >> a >> b;



    if(a==1&&b==2||a==2&&b==1)

        cout<<3<<endl;

    else if(a==2&&b==3||a==3&&b==2)

        cout<<1<<endl;

    else if(a==1&&b==3||a==3&&b==1)

        cout<<2<<endl;

    else

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char A, B;

	

	scanf("%c\n %c", &A, &B);

	

	if (A== '1'&&B=='2'){

		printf("3");

	}else if (A=='1'&&B=='3'){

		printf("2");

	}else if(A=='3'&&B=='1'){

		printf("2");

	}else if (A=='3'&&B=='2'){

		printf("1");

	}else if (A=='2'&&B=='1'){

		printf("3");

	}else if (A=='2'&&B=='3'){

		printf("1");

	}

	

	

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

//h3h3

int a,b;

int main() {

cin>>a>>b;

cout<<6-a-b;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char A, B;

	

	scanf("%c\n %c", &A, &B);

	

	if (A== '1'&&B=='2'){

		printf("3");

	}else if (A=='1'&&B=='3'){

		printf("2");

	}else if(A=='3'&&B=='1'){

		printf("2");

	}else if (A=='3'&&B=='2'){

		printf("1");

	}else if (A=='2'&&B=='1'){

		printf("3");

	}else if (A=='2'&&B=='3'){

		printf("1");

	}

	

	

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;







int main()

{

int a,b;

cin >> a >> b;

int x= a+b;

if(x==3){

    cout << "3";

}else if (x==4){

    cout << "2";

}else if (x==5){

    cout << "1";

}

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char A, B;

	

	scanf("%c\n %c", &A, &B);

	

	if (A== '1'&&B=='2'){

		printf("3");

	}else if (A=='1'&&B=='3'){

		printf("2");

	}else if(A=='3'&&B=='1'){

		printf("2");

	}else if (A=='3'&&B=='2'){

		printf("1");

	}else if (A=='2'&&B=='1'){

		printf("3");

	}else if (A=='2'&&B=='3'){

		printf("1");

	}

	

	

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/// --- In the name of ALLAH --- ///





#include <cmath>

#include<bits/stdc++.h>

using namespace std;





typedef long long              ll;

typedef vector<int>            vi;

typedef vector<ll>             vl;

typedef vector<vi>             vvi;

typedef vector<vl>             vvl;

typedef pair<int,int>          pii;

typedef pair<double, double>   pdd;

typedef pair<ll, ll>           pll;

typedef vector<pii>            vii;

typedef vector<pll>            vll;

typedef double                 dl;



#define endl                   '\n'

#define PB                     push_back

#define F                      first

#define S                      second

#define all(a)                 (a).begin(),(a).end()

#define rall(a)                (a).rbegin(),(a).rend()

#define sz(x)                  (ll)x.size()

#define wt                     ll t; cin>>t; while(t--)

#define input(a,n)             for(int i=0;i<n;i++) cin>>a[i];



const double PI = acos(-1);

const double eps = 1e-9;

const int inf = 2000000000;

const ll infLL = 9000000000000000000;





#define mem(a,b) memset(a, b, sizeof(a) )

#define sqr(a) ((a) * (a))

#define mod 10000007

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);



#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu () {            cerr << endl;}

template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}



ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }

ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }





const ll mx=1e9;



















int main()

{

    optimize();

int a,b;

cin>>a>>b;



if((a==1&&b==2)||(a==2&&b==1))

    cout<<3<<endl;

else if((a==1&&b==3)||(a==3&&b==1))

    cout<<2<<endl;

else if((a==3&&b==2)||(a==2&&b==3))

    cout<<1<<endl;









    return 0;

}
















































































// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char A, B;

	

	scanf("%c\n %c", &A, &B);

	

	if (A== '1'&&B=='2'){

		printf("3");

	}else if (A=='1'&&B=='3'){

		printf("2");

	}else if(A=='3'&&B=='1'){

		printf("2");

	}else if (A=='3'&&B=='2'){

		printf("1");

	}else if (A=='2'&&B=='1'){

		printf("3");

	}else if (A=='2'&&B=='3'){

		printf("1");

	}

	

	

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main()

{

   int A,B;

   cin>>A>>B;

   if((A==1 && B==2)||(A==2 && B==1))

   {

       cout<<"3";

   }

   else if((A==1 && B==3)||(A==3 && B==1))

   {

       cout<<"2";

   }

    else if((A==2 && B==3)||(A==3 && B==2))

   {

       cout<<"1";

   }

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char A, B;

	

	scanf("%c\n %c", &A, &B);

	

	if (A== '1'&&B=='2'){

		printf("3");

	}else if (A=='1'&&B=='3'){

		printf("2");

	}else if(A=='3'&&B=='1'){

		printf("2");

	}else if (A=='3'&&B=='2'){

		printf("1");

	}else if (A=='2'&&B=='1'){

		printf("3");

	}else if (A=='2'&&B=='3'){

		printf("1");

	}

	

	

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int a,b;



int main(){

    cin>>a>>b;

    if(a+b==3){

        cout<<3;

    }

    else if(a+b==4){

        cout<<2;

    }

    else{

        cout<<1;

    }

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main(){

	char A, B;

	

	scanf("%c\n %c", &A, &B);

	

	if (A== '1'&&B=='2'){

		printf("3");

	}else if (A=='1'&&B=='3'){

		printf("2");

	}else if(A=='3'&&B=='1'){

		printf("2");

	}else if (A=='3'&&B=='2'){

		printf("1");

	}else if (A=='2'&&B=='1'){

		printf("3");

	}else if (A=='2'&&B=='3'){

		printf("1");

	}

	

	

	

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):




#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

 

#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'

#define mset(d,val) memset(d,val,sizeof(d))

#define setp(x) cout<<fixed<<setprecision(x)

#define forn(i,a,b) for(int i=a;i<b;i++)

#define fore(i,a,b) for(int i=a;i<=b;i++)

#define pb push_back

#define mp make_pair

#define F first

#define S second

#define INF ll(1e18)

#define MOD 998244353

#define pqueue priority_queue

#define fbo find_by_order

#define ook order_of_key

typedef long long ll;

typedef pair<ll,ll> ii;

typedef vector<ll> vi;

typedef vector<ii> vii;

typedef long double ld;

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

 

#define MAXN 1000000007

 

 

int main() {

	ll a,b;

	cin>>a>>b;

	if ((a+b)==3) {

		cout<<3;

	}

	if ((a+b)==4) {

		cout<<2;

	}

	if ((a+b)==5) {

		cout<<1;

	}

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long



 

using namespace std;

int main()

{

	int a, b; 

	cin >> a >> b;

	cout << 6/(a*b); 

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std ;



int main()



{

    int a,b ;



    cin>>a>>b  ;



    if(a==1 && b==2 ||a==2 &&b==1)

    {

        cout<<"3"<<endl ;

    }

    else if(a==1 && b==3 ||a==3 &&b==1)

    {

        cout<<"2"<<endl ;

    }



    else if(a==3 && b==2 ||a==2 &&b==3)

    {

        cout<<"1"<<endl ;

    }



    return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int a, b ;



int main (){

   cin>>a;

   cin>>b;

   cout<< 6-a-b;



}

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//بسم الله الرحمن الرحيم

//* In The Name 0f ALLAH *//* The Most Beneficent *//* The Most Merciful *//*

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define el << endl

#define PI 3.141592653589793238

#define _test_ int t; cin >> t; while(t--)

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }

ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }

int dx[]={0,0,+1,-1,+1,-1,-1,+1};

int dy[]={+1,-1,0,0,+1,-1,+1,-1};

///*......................*//* LET'S BEGIN (-_^) *//*............................///

const int mx=1e5+123;

ll b,ans;



void _case_()

{

    int a,b;

    cin >> a >> b;

    cout << (6-(a+b)) el;

}



int main()

{

    //file();

    optimize();

    //_test_

        _case_();



    return 0;

}



///////////*  N A Y E M  *///////////

// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define scan($) scanf("%d",&$)

#define test() int $;scan($);while($--)

using namespace std;

int main()

{

    int a,b;

    scanf("%d %d",&a,&b);

    printf("%d\n",6-(a+b));

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b;

    if((a==1 && b==2) || (a==2 && b==1))

        cout<<"3"<<endl;

    else if((a==2 && b==3) || (a==3 && b==2))

        cout<<"1"<<endl;

    else if((a==3 && b==1) || (a==1 && b==3))

        cout<<"2"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int x, y, z;

int main() {

    x>=1 && x<=3 && y>=1 && y<=3;

    cin >> x >> y;

    z = 6 - (x+y);

    cout << z << endl;

   

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<vector>

#define lli long long int

#include<climits>

#include<unordered_map>

#include<algorithm>

#include<bitset>

#include<map>

#define pb push_back

using namespace std;



int main()

{

   

    int a,b;

    cin>>a>>b;

    vector<bool>arr(4);

    arr[a] = true;

    arr[b] = true;

    for(int i=1;i<4;i++)

        if(!arr[i])  cout<<i<<endl;

    

}




// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int main() {

	// your code goes here

	int b,c;

	cin>>b>>c;

	if(abs(b-c)==2)

	cout<<2;

	else if((b==1||b==2)&&(c==1||c==2))

	cout<<3;

	else

	cout<<1;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long int

#define vll vector<pair<ll, ll> >

#define vl vector<ll>

#define vi vector<int>

#define vii vector<pair<int, int> >

const ll mod = 1e9 + 7;

const ll inf = LLONG_MAX;

using namespace std;



ll power_mod(ll x, ll y, ll p)

{

	ll ans = 1;

	x = x%p;

	if(x==0)

	return p;



	while(y>0)

	{

		if(y&1)

		{

			ans = (ans*x)%p;

		}

		y = y>>1;

		x = (x*x)%p;

	}

	return ans;

} 



int main()

{

	ios_base::sync_with_stdio(false);

	cin.tie(0);

	

	ll i,j,k,l,m,n;

	ll a,b,c;

	cin>>a>>b;

	cout<<6-a-b;

	

	return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>



int main() {

	int A, B;

	scanf("%d %d", &A,&B);

	

	if (A == 1 && B == 2){

		printf("3\n");

	}else if (A == 1 && B == 3){

		printf("2\n");

	}else if (A == 2 && B == 1){

		printf("3\n");

	}else if (A == 2 && B == 3){

		printf("1\n");

	}else if (A == 3 && B == 1){

		printf("2\n");

	}else if (A == 3 && B == 2){

		printf("1\n");

	}

	

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



const int D = 4;

const int MODN = 1e9 + 7;



struct M {

	int d[D][D];

	M() {

		memset(d, 0, sizeof d);

	}

	M operator*(const M& other) const {

		M ret;

		for (int j = 0; j < D; ++ j)

			for (int i = 0; i < D; ++ i)

				for (int k = 0; k < D; ++ k) {

					ret.d[i][k] = (1LL * d[i][j] * other.d[j][k] + ret.d[i][k]) % MODN;

				}

		return ret;

	}

};



M pw(M x, int n) {

	M ret;

	for (int i = 0; i < D; ++ i) ret.d[i][i] = 1;

	for (; n; n >>= 1, x = x * x)

		if (n & 1) ret = ret * x;

	return ret;

}



int main() {

	std::ios::sync_with_stdio(false);

	M T, cur, Tb;

	for (int i = 0; i < D; ++ i) cur.d[i][i] = 1;

	T.d[0][3] = 1;

	T.d[1][1] = T.d[1][3] = 1;

	T.d[2][1] = T.d[2][2] = T.d[2][3] = 1;

	T.d[3][1] = 1; T.d[3][2] = T.d[3][3] = 2;



	Tb.d[1][1] = 1;

	Tb.d[2][1] = Tb.d[2][2] = 1;

	Tb.d[3][1] = 1; Tb.d[3][2] = 2; Tb.d[3][3] = 1;



	int n, m; std::cin >> n >> m;

	int last = 0;

	for (int i = 0; i < m; ++ i) {

		int x; std::cin >> x;

		cur = pw(T, x - last - 1) * cur;

		cur = Tb * cur;

		last = x;

	}



	cur = pw(T, n - last) * cur;

	int ans = 0;

	for (int i = 0; i < D; ++ i)

		ans = (ans + cur.d[0][i]) % MODN;

	std::cout << ans << std::endl;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <assert.h>



typedef long long LL;



const int MAXM = 1e5, MOD = 1e9 + 7;

int n, m;



inline int add ( int a, const int b ) { return ( a += b ) < MOD ? a : a - MOD; }

inline int mul ( LL a, const int b ) { return ( a *= b ) < MOD ? a : a % MOD; }



inline int rint () {

	int x = 0; char s = getchar ();

	for ( ; s < '0' || '9' < s; s = getchar () );

	for ( ; '0' <= s && s <= '9'; s = getchar () ) x = x * 10 + ( s ^ '0' );

	return x;

}



struct Matrix {

	int n, m, mat[3][3];

	Matrix (): n ( 0 ), m ( 0 ), mat {} {}

	Matrix ( const int tn, const int tm ): n ( tn ), m ( tm ), mat {} {}

	inline int* operator [] ( const int key ) { return mat[key]; }

	inline Matrix operator * ( Matrix t ) {

		assert ( m == t.n );

		Matrix ret ( n, t.m );

		for ( int i = 0; i < n; ++ i ) {

			for ( int k = 0; k < m; ++ k ) {

				for ( int j = 0; j < t.m; ++ j ) {

					ret[i][j] = add ( ret[i][j], mul ( mat[i][k], t[k][j] ) );

				}

			}

		}

		return ret;

	}

};



inline Matrix qkpow ( Matrix a, int b ) {

	Matrix ret ( a.n, a.m );

	for ( int i = 0; i < ret.n; ++ i ) ret[i][i] = 1;

	for ( ; b; a = a * a, b >>= 1 ) if ( b & 1 ) ret = ret * a;

	return ret;

}



Matrix I ( 3, 1 ), A ( 3, 3 ), B ( 3, 3 );



inline void init () {

	I[0][0] = 1;

	A[0][0] = 1;

	A[1][0] = 2, A[1][1] = 1;

	A[2][0] = A[2][1] = A[2][2] = 1;

	B = A, ++ B[0][0], ++ B[0][1], ++ B[0][2];

}



int main () {

	init ();

	n = rint (), m = rint ();

	int las = 0;

	for ( int i = 1, x; i <= m; ++ i ) {

		x = rint ();

		I = A * qkpow ( B, x - las - 1 ) * I;

		las = x;

	}

	

	I = A * qkpow ( B, n - las - 1 ) * I;

	printf ( "%d\n", I[2][0] );

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <iostream>

#include <algorithm>

#define ll long long

using namespace std;

#define N 100005

#define mod 1000000007

int n, m, x[N];

struct Matrix

{

	int A[3][3];

	Matrix(){memset(A, 0, sizeof A);}

	Matrix operator * (const Matrix &b)const

	{

		Matrix c;

		for (int i = 0; i < 3; i++)

			for (int k = 0; k < 3; k++)

				for (int j = 0; j < 3; j++)

					c.A[i][j] = (c.A[i][j] + (ll)A[i][k] * b.A[k][j]) % mod;

		return c;

	}

	void Init()

	{

		for (int i = 0; i < 3; i++)

			for (int j = 0; j < 3; j++)

				A[i][j]=1;

		A[0][1] = A[2][1] = A[2][2]=2;

		A[1][0] = 0;

	}

}ans, now, oth, mat, one;

void Pow(int k)

{

	now = one;

	mat.Init();

	while (k)

	{

		if (k & 1)

			now = now * mat;

		mat = mat * mat;

		k >>= 1;

	}

}

int main()

{

	scanf("%d%d", &n, &m);

	for (int i = 1; i <= m; i++)

		scanf("%d", &x[i]);

	x[++m] = n;

	oth.Init();

	oth.A[2][1] = oth.A[2][0] = 0;

	oth.A[2][2] = 1;

	for (int i = 0; i < 3; i++)

		one.A[i][i] = 1;

	ans.A[0][0] = 1;

	Pow(x[1]);

	ans = ans * now;

	for (int i = 1; i < m; i++)

		{

			ans = ans * oth;

			Pow(x[i + 1] - x[i] - 1);

			ans = ans * now;

		}

	printf("%d\n", ans.A[0][2]);

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <assert.h>



typedef long long LL;



const int MAXM = 1e5, MOD = 1e9 + 7;

int n, m;



inline int add ( int a, const int b ) { return ( a += b ) < MOD ? a : a - MOD; }

inline int mul ( LL a, const int b ) { return ( a *= b ) < MOD ? a : a % MOD; }



inline int rint () {

	int x = 0; char s = getchar ();

	for ( ; s < '0' || '9' < s; s = getchar () );

	for ( ; '0' <= s && s <= '9'; s = getchar () ) x = x * 10 + ( s ^ '0' );

	return x;

}



struct Matrix {

	int n, m, mat[3][3];

	Matrix (): n ( 0 ), m ( 0 ), mat {} {}

	Matrix ( const int tn, const int tm ): n ( tn ), m ( tm ), mat {} {}

	inline int* operator [] ( const int key ) { return mat[key]; }

	inline Matrix operator * ( Matrix t ) {

		assert ( m == t.n );

		Matrix ret ( n, t.m );

		for ( int i = 0; i < n; ++ i ) {

			for ( int k = 0; k < m; ++ k ) {

				for ( int j = 0; j < t.m; ++ j ) {

					ret[i][j] = add ( ret[i][j], mul ( mat[i][k], t[k][j] ) );

				}

			}

		}

		return ret;

	}

};



inline Matrix qkpow ( Matrix a, int b ) {

	Matrix ret ( a.n, a.m );

	for ( int i = 0; i < ret.n; ++ i ) ret[i][i] = 1;

	for ( ; b; a = a * a, b >>= 1 ) if ( b & 1 ) ret = ret * a;

	return ret;

}



Matrix I ( 3, 1 ), A ( 3, 3 ), B ( 3, 3 );



inline void init () {

	I[0][0] = 1;

	A[0][0] = 1;

	A[1][0] = 2, A[1][1] = 1;

	A[2][0] = A[2][1] = A[2][2] = 1;

	B = A, ++ B[0][0], ++ B[0][1], ++ B[0][2];

}



int main () {

	init ();

	n = rint (), m = rint ();

	int las = 0;

	for ( int i = 1, x; i <= m; ++ i ) {

		x = rint ();

		I = A * qkpow ( B, x - las - 1 ) * I;

		las = x;

	}

	

	I = A * qkpow ( B, n - las - 1 ) * I;

	printf ( "%d\n", I[2][0] );

	return 0;

}

// Fastest known solution for this problem: