import java.util.*;
import java.io.*;
import java.math.*;

    public  class Sample implements Runnable
    {
          static int n,m;
          static int max=1000005;
          static int[] s=new int[max];
          static int[] a=new int[max];
          public static void solve()
          {
             n=i();
             m=i();
             int k=i();
             int t=i();
             for(int i=0;i<n;i++)
             {
              a[i]=i();
             }
             for(int j=0;j<m;j++)
              {
                s[j]=i();
              }
              int ans=m;
              for (int kk=0;kk<m;kk++) {
                if(s[kk]>a[k-1])
                {
                  ans=kk;
                  break;
                }
              }

              if((m-ans)>=t)out.println("YES");
              else out.println("NO");
          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
         static class Pair implements Comparable<Pair>
         {
            long a;
            int b;
            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

            public int compareTo(Pair x)
           {
                return Long.compare(x.a,this.a);
           }
        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

          private final InputStream stream;
          private final byte[] buf = new byte[8192];
          private int curChar, snumChars;
          private SpaceCharFilter filter;

          public InputReader(InputStream stream) {
                  this.stream = stream;
          }

          public int snext()
         {
                  if (snumChars == -1)
                          throw new InputMismatchException();
                  if (curChar >= snumChars) {
                          curChar = 0;
                          try {
                                  snumChars = stream.read(buf);
                          } catch (IOException e) {
                                  throw new InputMismatchException();
                          }
                          if (snumChars <= 0)
                                  return -1;
                  }
                  return buf[curChar++];
          }

          public int nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public int[] nextIntArray(int n)
          {
                  int a[] = new int[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextInt();
                  }
                  return a;
          }

          public long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          public String nextLine()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                          c = snext();
                  StringBuilder res = new StringBuilder();
                  do {
                          res.appendCodePoint(c);
                          c = snext();
                  } while (!isEndOfLine(c));
                  return res.toString();
          }

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }


import java.util.*;
import java.io.*;
import java.math.*;

    public  class Sample implements Runnable
    {
          static int n;
          static int max=1000005;
          static int[] s=new int[max];
          static int[] a=new int[max];
          public static void solve()
          {
             n=i();
             for(int i=0;i<n;i++)
             {
               a[i]=i();
               s[a[i]]++;
             }
             boolean flag=true;
             for(int i=0;i<n;i++)
             {
              for(int j=i;j<n;j++)
              {
                if(s[gcd(a[i],a[j])]==0)
                {
                  flag=false;
                  break;
                }
              }
             }
             if(flag)
             {
              out.println(n);
              for(int i=0;i<n;i++)out.print(a[i]+" ");
             }
           else out.println("-1");

          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
         static class Pair implements Comparable<Pair>
         {
            long a;
            int b;
            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

            public int compareTo(Pair x)
           {
                return Long.compare(x.a,this.a);
           }
        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

          private final InputStream stream;
          private final byte[] buf = new byte[8192];
          private int curChar, snumChars;
          private SpaceCharFilter filter;

          public InputReader(InputStream stream) {
                  this.stream = stream;
          }

          public int snext()
         {
                  if (snumChars == -1)
                          throw new InputMismatchException();
                  if (curChar >= snumChars) {
                          curChar = 0;
                          try {
                                  snumChars = stream.read(buf);
                          } catch (IOException e) {
                                  throw new InputMismatchException();
                          }
                          if (snumChars <= 0)
                                  return -1;
                  }
                  return buf[curChar++];
          }

          public int nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public int[] nextIntArray(int n)
          {
                  int a[] = new int[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextInt();
                  }
                  return a;
          }

          public long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          public String nextLine()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                          c = snext();
                  StringBuilder res = new StringBuilder();
                  do {
                          res.appendCodePoint(c);
                          c = snext();
                  } while (!isEndOfLine(c));
                  return res.toString();
          }

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }


import java.util.*;
import java.io.*;
import java.math.*;

    public  class Sample implements Runnable
    {
          static int n,m;
          static int max=1000005;
          static int[] s=new int[max];
          static int[] a=new int[max];
          public static void solve()
          {
              n=i();
              int min=Integer.MAX_VALUE;
              int g=0;
              for(int i=0;i<n;i++)
              {
                a[i]=i();
                min=Math.min(min,a[i]);
                g=gcd(g,a[i]);
              }
              if(g!=min)out.println("-1");
              else
              {
                for(int i=0;i<n-1;i++)
                {
                  out.print(a[i]+" "+min+" ");
                }
                out.print(a[n-1]);
              }

          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Sample(), "whatever", 1<<26).start();
          }
         static class Pair implements Comparable<Pair>
         {
            long a;
            int b;
            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

            public int compareTo(Pair x)
           {
                return Long.compare(x.a,this.a);
           }
        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

          private final InputStream stream;
          private final byte[] buf = new byte[8192];
          private int curChar, snumChars;
          private SpaceCharFilter filter;

          public InputReader(InputStream stream) {
                  this.stream = stream;
          }

          public int snext()
         {
                  if (snumChars == -1)
                          throw new InputMismatchException();
                  if (curChar >= snumChars) {
                          curChar = 0;
                          try {
                                  snumChars = stream.read(buf);
                          } catch (IOException e) {
                                  throw new InputMismatchException();
                          }
                          if (snumChars <= 0)
                                  return -1;
                  }
                  return buf[curChar++];
          }

          public int nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public int[] nextIntArray(int n)
          {
                  int a[] = new int[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextInt();
                  }
                  return a;
          }

          public long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          public String nextLine()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                          c = snext();
                  StringBuilder res = new StringBuilder();
                  do {
                          res.appendCodePoint(c);
                          c = snext();
                  } while (!isEndOfLine(c));
                  return res.toString();
          }

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }


import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class CFA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;

    void solve() throws IOException {
        int n = nextInt();
        int[] arr = nextIntArr(n);
        int g = arr[0];
        for (int i = 1; i < n; i++) {
            g = gcd(g, arr[i]);
        }

        if (g != arr[0]) {
            out(-1);
            return;
        }

        List<Integer> res = new ArrayList<>();
        for (int v : arr) {
            res.add(v);
        }
        for (int i = 1; i < n; i++) {
            res.add(Math.min(arr[i], arr[i - 1]));
        }

        outln(res.size());
        for (int v : res) {
            out(v + " ");
        }
    }

    int gcd(int a, int b) {
        if (a == 0 || b == 0) {
            return a + b;
        }
        else {
            return gcd(b, a % b);
        }
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }

    void swap(int[] a) {
        for (int i = 0, j = a.length - 1; i < j; i++, j--) {
            int tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public CFA() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CFA();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class CFA {
    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;

    void solve() throws IOException {
        int n = nextInt();
        int[] arr = nextIntArr(n);
        int g = arr[0];
        for (int i = 1; i < n; i++) {
            g = gcd(g, arr[i]);
        }

        Arrays.sort(arr);
        if (g != arr[0]) {
            out(-1);
            return;
        }

        Set<Integer> res = new HashSet<>();
        for (int v : arr) {
            res.add(v);
        }
        for (int i = 1; i < n; i++) {
            res.add(Math.min(arr[i], arr[i - 1]));
        }

        outln(res.size());
        for (int v : res) {
            out(v + " ");
        }
    }

    int gcd(int a, int b) {
        if (a == 0 || b == 0) {
            return a + b;
        }
        else {
            return gcd(b, a % b);
        }
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }

    void swap(int[] a) {
        for (int i = 0, j = a.length - 1; i < j; i++, j--) {
            int tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public CFA() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CFA();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=1e5+5,inf=1e17;
ll n,m,q,seg[2][5*N],lazy[2][5*N],a[N],b[N];
void push(ll t,ll node,ll l,ll r){
    if(lazy[t][node]==0)return;
    seg[t][node]+=(r-l+1)*lazy[t][node];
    if(l!=r){
        lazy[t][2*node]+=lazy[t][node];
        lazy[t][2*node+1]+=lazy[t][node];
    }
    lazy[t][node]=0;
}
void upd(ll t,ll node,ll l,ll r,ll ql,ll qr,ll x){
    push(t,node,l,r);
    if(qr<l || r<ql)return;
    if(ql<=l && r<=qr){
        lazy[t][node]+=x;
        push(t,node,l,r);
        return;
    }
    ll mid=(l+r)>>1;
    upd(t,2*node,l,mid,ql,qr,x);
    upd(t,2*node+1,mid+1,r,ql,qr,x);
    seg[t][node]=seg[t][2*node] + seg[t][2*node+1];
}
ll query(ll t,ll node,ll l,ll r,ll ql,ll qr){
    push(t,node,l,r);
    if(qr<l || r<ql)return 0;
    if(ql<=l && r<=qr)return seg[t][node];
    ll mid=(l+r)>>1;
    return query(t,2*node,l,mid,ql,qr) + query(t,2*node+1,mid+1,r,ql,qr);
}
void update(ll l,ll r,ll val){
    ll s= l + (1 - l%2);
    ll e= r - (1-r%2);
    s = (s+1)/2;
    e = (e+1)/2;
    if(s<=e)upd(1,1,1,(n+1)/2,s,e,val);

    s = l + l%2;
    e = r - r%2;
    s = (s+1)/2;
    e = (e+1)/2;
    if(s<=e)upd(0,1,1,(n+1)/2,s,e,val);
}
set<ll> st;
void calc(){
    ll pos = query(1,1,1,(n+1)/2,1,(n+1)/2);
    ll neg = query(0,1,1,(n+1)/2,1,(n+1)/2);
    ll val = pos - neg;
    auto v1 = st.lower_bound(val);
    auto v2 = st.upper_bound(val);
    if(v1==st.end())v1--;
    if(v2==st.end())v2--;
    ll ans = min(abs(*v1 - val) , abs(*v2 - val));
    cout<<ans<<"\n";
}
ll prfx[N];
void init(){
    ll val[]={-1,1};
    for(ll i=1;i<=m;i++)prfx[i]=prfx[i-1] + val[i%2]*b[i];
    for(ll i=n;i<=m;i++){
        ll val = prfx[i] - prfx[i-n];
        if((i-n+1)%2==0)val*=-1;
        st.insert(val);
    }
}
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin>>n>>m>>q;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
        update(i,i,a[i]);
    }

    for(ll i=1;i<=m;i++)cin>>b[i];
    init();
    calc();
    for(;q>0;q--){
        ll l,r,x;cin>>l>>r>>x;
        update(l,r,x);
        calc();
    }
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
int query(int x,vector<int>&st){
      int val1=1e18;
      int idx=lower_bound(all(st),-x)-st.begin();
      if(idx<sz(st))val1=abs(st[idx]+x);
      if(idx-1>=0)mins(val1,abs(st[idx-1]+x));
      return val1;
}
int solve(){
 int n,m,q;cin>>n>>m>>q;
 vector<int>b(m+1);
 int sum=0;
 rep(i,1,n+1){
    int t;cin>>t;
    if(i%2==0)t*=-1;
    sum+=t;
 }
 rep(i,1,m+1){
 	cin>>b[i];
 	if(i%2)b[i]*=-1;
 }
 set<int>st;
 int s=0;
 for(int i=1;i<=n;i++)s+=b[i];
 st.insert(s);
 for(int i=2;i+n-1<=m;i++){
    s-=b[i-1];
    s+=b[i+n-1];
    if(i%2){
    	st.insert(s);
    }
    else{
    	st.insert(-s);
    }
 }
 vector<int>v;
 for(auto i:st)v.pb(i);
 int a=sum;
 cout<<query(a,v)<<endl;
 rep3(q){
 	int l,r,x;cin>>l>>r>>x;
 	if(l%2==r%2){
      int val=x;
      if(l%2==0)val*=-1;
      sum+=val;
 	}
 	int a=sum;
 	cout<<query(a,v)<<endl;
  }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
int solve(){
 int n,m,q;cin>>n>>m>>q;
 vector<int>b(m+1);
 int sum=0;
 rep(i,1,n+1){
    int t;cin>>t;
    if(i%2==0)t*=-1;
    sum+=t;
 }
 rep(i,1,m+1){
 	cin>>b[i];
 	if(i%2)b[i]*=-1;
 }
 set<int>st;
 int s=0;
 for(int i=1;i<=n;i++)s+=b[i];
 st.insert(s);
 for(int i=2;i+n-1<=m;i++){
    s-=b[i-1];
    s+=b[i+n-1];
    if(i%2){
    	st.insert(s);
    }
    else{
    	st.insert(-s);
    }
 }
 vector<int>v;
 for(auto i:st)v.pb(i);
 auto query = [&](int x){
      int val1=1e18;
      int idx=lower_bound(all(v),-x)-v.begin();
      if(idx<sz(st))val1=abs(v[idx]+x);
      if(idx-1>=0)mins(val1,abs(v[idx-1]+x));
      return val1;
 };
 int a=sum;
 cout<<query(a)<<endl;
 rep3(q){
 	int l,r,x;cin>>l>>r>>x;
 	if(l%2==r%2){
      int val=x;
      if(l%2==0)val*=-1;
      sum+=val;
 	}
 	int a=sum;
 	cout<<query(a)<<endl;
  }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
int solve(){
 int n,m,q;cin>>n>>m>>q;
 vector<int>b(m+1);
 int sum=0;
 rep(i,1,n+1){
    int t;cin>>t;
    if(i%2==0)t*=-1;
    sum+=t;
 }
 rep(i,1,m+1){
 	cin>>b[i];
 	if(i%2)b[i]*=-1;
 }
 set<int>st;
 int s=0;
 for(int i=1;i<=n;i++)s+=b[i];
 st.insert(s);
 for(int i=2;i+n-1<=m;i++){
    s-=b[i-1];
    s+=b[i+n-1];
    if(i%2){
    	st.insert(s);
    }
    else{
    	st.insert(-s);
    }
 }
 vector<int>v;
 for(auto i:st)v.pb(i);
 auto query = [&](int x,vector<int>&st){
      int val1=1e18;
      int idx=lower_bound(all(st),-x)-st.begin();
      if(idx<sz(st))val1=abs(st[idx]+x);
      if(idx-1>=0)mins(val1,abs(st[idx-1]+x));
      return val1;
 };
 int a=sum;
 cout<<query(a,v)<<endl;
 rep3(q){
 	int l,r,x;cin>>l>>r>>x;
 	if(l%2==r%2){
      int val=x;
      if(l%2==0)val*=-1;
      sum+=val;
 	}
 	int a=sum;
 	cout<<query(a,v)<<endl;
  }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
template<typename T>
struct Fenwick{
    vector<T> tree;
    Fenwick(int n){
        tree.resize(n);
    }

    T query(int i){
        int sum=0;
        i++;
        while(i){
           sum+=tree[i];
           i-=i&(-i);
       }
       return sum;
    }
    void update(int i,int n,T val){
       i++;
       while(i<=n){
          tree[i]+=val;
          i+=i&(-i);
       }
    }
};

int solve(){
 int n,m,q;cin>>n>>m>>q;
 vector<int>b(m+1);
 Fenwick<int>fn(n+2);
 int sum=0;
 rep(i,1,n+1){
    int t;cin>>t;
    if(i%2==0)t*=-1;
    sum+=t;
 }
 rep(i,1,m+1){
 	cin>>b[i];
 	if(i%2)b[i]*=-1;
 }
 set<int>st;
 int s=0;
 for(int i=1;i<=n;i++)s+=b[i];
 st.insert(s);
 for(int i=2;i+n-1<=m;i++){
    s-=b[i-1];
    s+=b[i+n-1];
    if(i%2){
    	st.insert(s);
    }
    else{
    	st.insert(-s);
    }
 }
 auto query = [&](int x,set<int>st){
 	  x*=-1;
      if(pres(st,x))return 0LL;
      int val1=1e18,val2=1e18;
      auto itr=st.upper_bound(x);
      if(itr!=st.end())val1=abs(*itr-x);
      if(itr!=st.begin()){
      	 --itr;
      	 val2=abs(*itr-x);
      }
      mins(val1,val2);
      return val1;
 };
 int a=sum;
 cout<<query(a,st)<<endl;
 rep3(q){
 	int l,r,x;cin>>l>>r>>x;
 	if(l%2==r%2){
      int val=x;
      if(l%2==0)val*=-1;
      sum+=val;
 	}
 	int a=sum;
 	cout<<query(a,st)<<endl;
  }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
int solve(){
 int n,m,q;cin>>n>>m>>q;
 vector<int>b(m+1);
 int sum=0;
 rep(i,1,n+1){
    int t;cin>>t;
    if(i%2==0)t*=-1;
    sum+=t;
 }
 rep(i,1,m+1){
 	cin>>b[i];
 	if(i%2)b[i]*=-1;
 }
 set<int>st;
 int s=0;
 for(int i=1;i<=n;i++)s+=b[i];
 st.insert(s);
 for(int i=2;i+n-1<=m;i++){
    s-=b[i-1];
    s+=b[i+n-1];
    if(i%2){
    	st.insert(s);
    }
    else{
    	st.insert(-s);
    }
 }
 vector<int>v;
 for(auto i:st)v.pb(i);
 auto query = [&](int x,vector<int>st){
      int val1=1e18;
      int idx=lower_bound(all(st),-x)-st.begin();
      if(idx<sz(st))val1=abs(st[idx]+x);
      if(idx-1>=0)mins(val1,abs(st[idx-1]+x));
      return val1;
 };
 int a=sum;
 cout<<query(a,v)<<endl;
 rep3(q){
 	int l,r,x;cin>>l>>r>>x;
 	if(l%2==r%2){
      int val=x;
      if(l%2==0)val*=-1;
      sum+=val;
 	}
 	int a=sum;
 	cout<<query(a,v)<<endl;
  }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>

#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define ll             long long
#define int            long long
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define mem0(a)        memset(a,0,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define hell           1000000007
#define elasped_time   1.0 * clock() / CLOCKS_PER_SEC
using namespace std;

template<typename T1,typename T2>istream& operator>>(istream& in,pair<T1,T2> &a){in>>a.x>>a.y;return in;}
template<typename T1,typename T2>ostream& operator<<(ostream& out,pair<T1,T2> a){out<<a.x<<" "<<a.y;return out;}
template<typename T,typename T1>T maxs(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T mins(T &a,T1 b){if(b<a)a=b;return a;}
template<typename T>
struct Fenwick{
    vector<T> tree;
    Fenwick(int n){
        tree.resize(n);
    }

    T query(int i){
        int sum=0;
        i++;
        while(i){
           sum+=tree[i];
           i-=i&(-i);
       }
       return sum;
    }
    void update(int i,int n,T val){
       i++;
       while(i<=n){
          tree[i]+=val;
          i+=i&(-i);
       }
    }
};

int solve(){
 int n,m,q;cin>>n>>m>>q;
 vector<int>b(m+1);
 Fenwick<int>fn(n+2);
 int sum=0;
 rep(i,1,n+1){
    int t;cin>>t;
    if(t%2==0)t*=-1;
    sum+=t;
 }
 rep(i,1,m+1){
 	cin>>b[i];
 	if(i%2)b[i]*=-1;
 }
 set<int>st;
 int s=0;
 for(int i=1;i<=n;i++)s+=b[i];
 st.insert(s);
 for(int i=2;i+n-1<=m;i++){
    s-=b[i-1];
    s+=b[i+n-1];
    if(i%2){
    	st.insert(s);
    }
    else{
    	st.insert(-s);
    }
 }
 auto query = [&](int x,set<int>st){
 	  x*=-1;
      if(pres(st,x))return 0LL;
      int val1=1e18,val2=1e18;
      auto itr=st.upper_bound(x);
      if(itr!=st.end())val1=abs(*itr-x);
      if(itr!=st.begin()){
      	 --itr;
      	 val2=abs(*itr-x);
      }
      mins(val1,val2);
      return val1;
 };
 int a=sum;
 cout<<query(a,st)<<endl;
 rep3(q){
 	int l,r,x;cin>>l>>r>>x;
 	if(l%2==r%2){
      int val=x;
      if(l%2==0)val*=-1;
      sum+=val;
 	}
 	int a=sum;
 	cout<<query(a,st)<<endl;
  }
 return 0;
}
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef SIEVE
    sieve();
    #endif
    #ifdef NCR
    init();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


/*
ID: awesome35
LANG: C++14
TASK: vans
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<chrono>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
// warning: ld is rougly 2x slower than double. Proof: ld: https://oj.uz/submission/319677 double: https://oj.uz/submission/319678
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define mp make_pair
#define rsz resize
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define f first
#define s second
//#define endl '\n'
#define test int testc;cin>>testc;while(testc--)
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; // for every grid problem!!
const ll linf = 4000000000000000000LL;
const ll inf = 1000000007;//998244353
const ld pi = 3.1415926535;

void pv(vi a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vll a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vector<vi>a) {
	F0R(i, sz(a)) { cout << i << endl; pv(a[i]); cout << endl; }
}void pv(vector<vll>a) { F0R(i, sz(a)) { cout << i << endl; pv(a[i]); }cout << endl; }void pv(vector<string>a) { trav(x, a)cout << x << endl; cout << endl; }
void build_primes(vi& primes, int size)
{
	vi visited;
	visited.rsz(size, 0);
	FOR(i, 2, size)
	{
		if (visited[i] == 0)
		{
			primes.pb(i);
			int a = i;
			while (a < size)
			{
				visited[a] = 1;
				a += i;
			}
		}
	}
}
vector<vector<ll>> matrix_mult(vector<vector<ll>>& a, vector<vector<ll>>& b)
{
	int n = a.size();
	vector<vector<ll>> answer;
	answer.resize(n);
	for (int i = 0; i < n; i++) answer[i].resize(n, 0);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++) // calculate answer[i][j]
		{
			for (int k = 0; k < n; k++)
				answer[i][j] = (answer[i][j] + a[i][k] * b[k][j]) % inf;
		}
	}
	return answer;
}
int modInverse(int a, int m)
{
	int m0 = m;
	int y = 0, x = 1;
	if (m == 1)
		return 0;
	while (a > 1)
	{
		// q is quotient
		int q = a / m;
		int t = m;
		// m is remainder now, process same as
		// Euclid's algo
		m = a % m, a = t;
		t = y;
		// Update y and x
		y = x - q * y;
		x = t;
	}
	// Make x positive
	if (x < 0)
		x += m0;

	return x;
}
ll power(ll x, ll y)
{
	ll k = 1LL << 60;
	ll z = 1;
	while (k != 0)
	{
		z *= z;
		z %= inf;
		if (y >= k)
		{
			z *= x;
			z %= inf;
			y -= k;
		}
		k >>= 1;
	}
	return z;
}
struct point
{
	ld x, y;
	bool operator<(const point& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
struct pt
{
	ll x, y;
	bool operator<(const pt& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
// remember that you need to take abs
long double area(point x, point y, point z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(point x, point y, point z)
{
	return area(x, y, z) > 0;
}
// remember that you need to take abs
long double area(pt x, pt y, pt z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(pt x, pt y, pt z)
{
	return area(x, y, z) > 0;
}
ll gcd(ll a, ll b)
{
	if (a > b)swap(a, b);
	if (a == 0)return b;
	return gcd(a, b % a);
}
int popcount(ll a)
{
	int count = 0;
	while (a)
	{
		count += (a & 1);
		a >>= 1;
	}
	return count;
}
ll choose(ll n, ll r)
{
	ll p = 1, k = 1;
	if (n - r < r)
		r = n - r;
	if (r != 0) {
		while (r) {
			p *= n;
			k *= r;
			long long m = gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else
		p = 1;
	return p;
}
vll prefix_hash(string& a, vll& powers, ll mod)
{
	int n = sz(a);
	vll prefix(n + 1);
	F0R(i, n)prefix[i + 1] = (prefix[i] + powers[i] * (a[i] - '1' + 1)) % mod;
	return prefix;
}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
struct custom_hash_fast {
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		x ^= FIXED_RANDOM;
		return x ^ (x >> 16);
	}
};
void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
	if (sz(s))
	{
		freopen((s + ".in").c_str(), "r", stdin);
		if (s != "test3")
			freopen((s + ".out").c_str(), "w", stdout);
	}
}
int main()
{
	setIO("");
	int n, m, q;
	cin >> n >> m >> q;
	vll a(n), b(m);
	F0R(i, n)cin >> a[i];
	trav(x, b)cin >> x;
	ll sum = 0;
	F0R(i, n)
	{
		if (i & 1)sum -= a[i];
		else sum += a[i];
	}
	ll curr = 0;
	vector<ll>val;
	F0R(i, n)
	{
		if (i & 1)curr -= b[i];
		else curr += b[i];
	}
	val.pb(curr);
	F0R(i, m - n)
	{
		curr -= b[i];
		curr = -curr;
		if (n & 1)
		{
			curr += b[i + n];
		}
		else
		{
			curr -= b[i + n];
		}
		val.pb(abs(curr));
	}
	sort(all(val));
	auto it = lower_bound(all(val), sum);
	ll ans = linf;
	if (it == val.end())
	{
		ans = min(ans, sum - val.back());
	}
	else
	{
		ans = min(ans, *it - sum);
		if (it != val.begin())
		{
			it--;
			ans = min(ans, sum - *it);
		}
	}
	cout << ans << endl;
	F0R(i, q)
	{
		ll a, b, c;
		cin >> a >> b >> c;
		if ((b - a) & 1)
		{
			//do nothing
		}
		else
		{
			sum += (a & 1 ? c : -c);
		}
		auto it = lower_bound(all(val), sum);
		ll ans = linf;
		if (it == val.end())
		{
			ans = min(ans, sum - val.back());
		}
		else
		{
			ans = min(ans, *it - sum);
			if (it != val.begin())
			{
				it--;
				ans = min(ans, sum - *it);
			}
		}
		cout << ans << endl;
	}
}


/*
ID: awesome35
LANG: C++14
TASK: vans
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<chrono>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
// warning: ld is rougly 2x slower than double. Proof: ld: https://oj.uz/submission/319677 double: https://oj.uz/submission/319678
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define mp make_pair
#define rsz resize
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define f first
#define s second
//#define endl '\n'
#define test int testc;cin>>testc;while(testc--)
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; // for every grid problem!!
const ll linf = 4000000000000000000LL;
const ll inf = 1000000007;//998244353
const ld pi = 3.1415926535;

void pv(vi a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vll a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vector<vi>a) {
	F0R(i, sz(a)) { cout << i << endl; pv(a[i]); cout << endl; }
}void pv(vector<vll>a) { F0R(i, sz(a)) { cout << i << endl; pv(a[i]); }cout << endl; }void pv(vector<string>a) { trav(x, a)cout << x << endl; cout << endl; }
void build_primes(vi& primes, int size)
{
	vi visited;
	visited.rsz(size, 0);
	FOR(i, 2, size)
	{
		if (visited[i] == 0)
		{
			primes.pb(i);
			int a = i;
			while (a < size)
			{
				visited[a] = 1;
				a += i;
			}
		}
	}
}
vector<vector<ll>> matrix_mult(vector<vector<ll>>& a, vector<vector<ll>>& b)
{
	int n = a.size();
	vector<vector<ll>> answer;
	answer.resize(n);
	for (int i = 0; i < n; i++) answer[i].resize(n, 0);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++) // calculate answer[i][j]
		{
			for (int k = 0; k < n; k++)
				answer[i][j] = (answer[i][j] + a[i][k] * b[k][j]) % inf;
		}
	}
	return answer;
}
int modInverse(int a, int m)
{
	int m0 = m;
	int y = 0, x = 1;
	if (m == 1)
		return 0;
	while (a > 1)
	{
		// q is quotient
		int q = a / m;
		int t = m;
		// m is remainder now, process same as
		// Euclid's algo
		m = a % m, a = t;
		t = y;
		// Update y and x
		y = x - q * y;
		x = t;
	}
	// Make x positive
	if (x < 0)
		x += m0;

	return x;
}
ll power(ll x, ll y)
{
	ll k = 1LL << 60;
	ll z = 1;
	while (k != 0)
	{
		z *= z;
		z %= inf;
		if (y >= k)
		{
			z *= x;
			z %= inf;
			y -= k;
		}
		k >>= 1;
	}
	return z;
}
struct point
{
	ld x, y;
	bool operator<(const point& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
struct pt
{
	ll x, y;
	bool operator<(const pt& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
// remember that you need to take abs
long double area(point x, point y, point z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(point x, point y, point z)
{
	return area(x, y, z) > 0;
}
// remember that you need to take abs
long double area(pt x, pt y, pt z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(pt x, pt y, pt z)
{
	return area(x, y, z) > 0;
}
ll gcd(ll a, ll b)
{
	if (a > b)swap(a, b);
	if (a == 0)return b;
	return gcd(a, b % a);
}
int popcount(ll a)
{
	int count = 0;
	while (a)
	{
		count += (a & 1);
		a >>= 1;
	}
	return count;
}
ll choose(ll n, ll r)
{
	ll p = 1, k = 1;
	if (n - r < r)
		r = n - r;
	if (r != 0) {
		while (r) {
			p *= n;
			k *= r;
			long long m = gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else
		p = 1;
	return p;
}
vll prefix_hash(string& a, vll& powers, ll mod)
{
	int n = sz(a);
	vll prefix(n + 1);
	F0R(i, n)prefix[i + 1] = (prefix[i] + powers[i] * (a[i] - '1' + 1)) % mod;
	return prefix;
}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
struct custom_hash_fast {
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		x ^= FIXED_RANDOM;
		return x ^ (x >> 16);
	}
};
void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
	if (sz(s))
	{
		freopen((s + ".in").c_str(), "r", stdin);
		if (s != "test3")
			freopen((s + ".out").c_str(), "w", stdout);
	}
}
int main()
{
	setIO("");
	int n, m, q;
	cin >> n >> m >> q;
	vll a(n), b(m);
	F0R(i, n)cin >> a[i];
	trav(x, b)cin >> x;
	ll sum = 0;
	F0R(i, n)
	{
		if (i & 1)sum -= a[i];
		else sum += a[i];
	}
	ll curr = 0;
	vector<ll>val;
	F0R(i, n)
	{
		if (i & 1)curr -= b[i];
		else curr += b[i];
	}
	val.pb(curr);
	F0R(i, m - n)
	{
		curr -= b[i];
		curr = -curr;
		if (n & 1)
		{
			curr += b[i + n];
		}
		else
		{
			curr -= b[i + n];
		}
		val.pb(abs(curr));
	}
	sort(all(val));
	auto it = lower_bound(all(val), sum);
	ll ans = linf;
	if (it == val.end())
	{
		ans = min(ans, val.back() - sum);
	}
	else
	{
		ans = min(ans, *it - sum);
		if (it != val.begin())
		{
			it--;
			ans = min(ans, sum - *it);
		}
	}
	cout << ans << endl;
	F0R(i, q)
	{
		ll a, b, c;
		cin >> a >> b >> c;
		if (b - a & 1)
		{
			//do nothing
		}
		else
		{
			sum += c;
		}
		auto it = lower_bound(all(val), sum);
		ll ans = linf;
		if (it == val.end())
		{
			ans = min(ans, sum - val.back());
		}
		else
		{
			ans = min(ans, *it - sum);
			if (it != val.begin())
			{
				it--;
				ans = min(ans, sum - *it);
			}
		}
		cout << ans << endl;
	}
}


/*
ID: awesome35
LANG: C++14
TASK: vans
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<chrono>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
// warning: ld is rougly 2x slower than double. Proof: ld: https://oj.uz/submission/319677 double: https://oj.uz/submission/319678
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define mp make_pair
#define rsz resize
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define f first
#define s second
//#define endl '\n'
#define test int testc;cin>>testc;while(testc--)
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; // for every grid problem!!
const ll linf = 4000000000000000000LL;
const ll inf = 1000000007;//998244353
const ld pi = 3.1415926535;

void pv(vi a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vll a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vector<vi>a) {
	F0R(i, sz(a)) { cout << i << endl; pv(a[i]); cout << endl; }
}void pv(vector<vll>a) { F0R(i, sz(a)) { cout << i << endl; pv(a[i]); }cout << endl; }void pv(vector<string>a) { trav(x, a)cout << x << endl; cout << endl; }
void build_primes(vi& primes, int size)
{
	vi visited;
	visited.rsz(size, 0);
	FOR(i, 2, size)
	{
		if (visited[i] == 0)
		{
			primes.pb(i);
			int a = i;
			while (a < size)
			{
				visited[a] = 1;
				a += i;
			}
		}
	}
}
vector<vector<ll>> matrix_mult(vector<vector<ll>>& a, vector<vector<ll>>& b)
{
	int n = a.size();
	vector<vector<ll>> answer;
	answer.resize(n);
	for (int i = 0; i < n; i++) answer[i].resize(n, 0);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++) // calculate answer[i][j]
		{
			for (int k = 0; k < n; k++)
				answer[i][j] = (answer[i][j] + a[i][k] * b[k][j]) % inf;
		}
	}
	return answer;
}
int modInverse(int a, int m)
{
	int m0 = m;
	int y = 0, x = 1;
	if (m == 1)
		return 0;
	while (a > 1)
	{
		// q is quotient
		int q = a / m;
		int t = m;
		// m is remainder now, process same as
		// Euclid's algo
		m = a % m, a = t;
		t = y;
		// Update y and x
		y = x - q * y;
		x = t;
	}
	// Make x positive
	if (x < 0)
		x += m0;

	return x;
}
ll power(ll x, ll y)
{
	ll k = 1LL << 60;
	ll z = 1;
	while (k != 0)
	{
		z *= z;
		z %= inf;
		if (y >= k)
		{
			z *= x;
			z %= inf;
			y -= k;
		}
		k >>= 1;
	}
	return z;
}
struct point
{
	ld x, y;
	bool operator<(const point& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
struct pt
{
	ll x, y;
	bool operator<(const pt& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
// remember that you need to take abs
long double area(point x, point y, point z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(point x, point y, point z)
{
	return area(x, y, z) > 0;
}
// remember that you need to take abs
long double area(pt x, pt y, pt z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(pt x, pt y, pt z)
{
	return area(x, y, z) > 0;
}
ll gcd(ll a, ll b)
{
	if (a > b)swap(a, b);
	if (a == 0)return b;
	return gcd(a, b % a);
}
int popcount(ll a)
{
	int count = 0;
	while (a)
	{
		count += (a & 1);
		a >>= 1;
	}
	return count;
}
ll choose(ll n, ll r)
{
	ll p = 1, k = 1;
	if (n - r < r)
		r = n - r;
	if (r != 0) {
		while (r) {
			p *= n;
			k *= r;
			long long m = gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else
		p = 1;
	return p;
}
vll prefix_hash(string& a, vll& powers, ll mod)
{
	int n = sz(a);
	vll prefix(n + 1);
	F0R(i, n)prefix[i + 1] = (prefix[i] + powers[i] * (a[i] - '1' + 1)) % mod;
	return prefix;
}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
struct custom_hash_fast {
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		x ^= FIXED_RANDOM;
		return x ^ (x >> 16);
	}
};
void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
	if (sz(s))
	{
		freopen((s + ".in").c_str(), "r", stdin);
		if (s != "test3")
			freopen((s + ".out").c_str(), "w", stdout);
	}
}
int main()
{
	setIO("");
	int n, m, q;
	cin >> n >> m >> q;
	vll a(n), b(m);
	F0R(i, n)cin >> a[i];
	trav(x, b)cin >> x;
	ll sum = 0;
	F0R(i, n)
	{
		if (i & 1)sum -= a[i];
		else sum += a[i];
	}
	ll curr = 0;
	vector<ll>val;
	F0R(i, n)
	{
		if (i & 1)curr -= b[i];
		else curr += b[i];
	}
	val.pb(curr);
	F0R(i, m - n)
	{
		curr -= b[i];
		curr = -curr;
		if (n & 1)
		{
			curr += b[i + n];
		}
		else
		{
			curr -= b[i + n];
		}
		val.pb(curr);
	}
	sort(all(val));
	auto it = lower_bound(all(val), sum);
	ll ans = linf;
	if (it == val.end())
	{
		ans = min(ans, sum - val.back());
	}
	else
	{
		ans = min(ans, *it - sum);
		if (it != val.begin())
		{
			it--;
			ans = min(ans, sum - *it);
		}
	}
	cout << ans << endl;
	F0R(i, q)
	{
		ll a, b, c;
		cin >> a >> b >> c;
		if ((b - a) & 1)
		{
			//do nothing
		}
		else
		{
			sum += (a & 1 ? c : -c);
		}
		auto it = lower_bound(all(val), sum);
		ll ans = linf;
		if (it == val.end())
		{
			ans = min(ans, sum - val.back());
		}
		else
		{
			ans = min(ans, *it - sum);
			if (it != val.begin())
			{
				it--;
				ans = min(ans, sum - *it);
			}
		}
		cout << ans << endl;
	}
}


/*
ID: awesome35
LANG: C++14
TASK: vans
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<chrono>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
// warning: ld is rougly 2x slower than double. Proof: ld: https://oj.uz/submission/319677 double: https://oj.uz/submission/319678
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define mp make_pair
#define rsz resize
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define f first
#define s second
//#define endl '\n'
#define test int testc;cin>>testc;while(testc--)
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; // for every grid problem!!
const ll linf = 4000000000000000000LL;
const ll inf = 1000000007;//998244353
const ld pi = 3.1415926535;

void pv(vi a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vll a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vector<vi>a) {
	F0R(i, sz(a)) { cout << i << endl; pv(a[i]); cout << endl; }
}void pv(vector<vll>a) { F0R(i, sz(a)) { cout << i << endl; pv(a[i]); }cout << endl; }void pv(vector<string>a) { trav(x, a)cout << x << endl; cout << endl; }
void build_primes(vi& primes, int size)
{
	vi visited;
	visited.rsz(size, 0);
	FOR(i, 2, size)
	{
		if (visited[i] == 0)
		{
			primes.pb(i);
			int a = i;
			while (a < size)
			{
				visited[a] = 1;
				a += i;
			}
		}
	}
}
vector<vector<ll>> matrix_mult(vector<vector<ll>>& a, vector<vector<ll>>& b)
{
	int n = a.size();
	vector<vector<ll>> answer;
	answer.resize(n);
	for (int i = 0; i < n; i++) answer[i].resize(n, 0);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++) // calculate answer[i][j]
		{
			for (int k = 0; k < n; k++)
				answer[i][j] = (answer[i][j] + a[i][k] * b[k][j]) % inf;
		}
	}
	return answer;
}
int modInverse(int a, int m)
{
	int m0 = m;
	int y = 0, x = 1;
	if (m == 1)
		return 0;
	while (a > 1)
	{
		// q is quotient
		int q = a / m;
		int t = m;
		// m is remainder now, process same as
		// Euclid's algo
		m = a % m, a = t;
		t = y;
		// Update y and x
		y = x - q * y;
		x = t;
	}
	// Make x positive
	if (x < 0)
		x += m0;

	return x;
}
ll power(ll x, ll y)
{
	ll k = 1LL << 60;
	ll z = 1;
	while (k != 0)
	{
		z *= z;
		z %= inf;
		if (y >= k)
		{
			z *= x;
			z %= inf;
			y -= k;
		}
		k >>= 1;
	}
	return z;
}
struct point
{
	ld x, y;
	bool operator<(const point& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
struct pt
{
	ll x, y;
	bool operator<(const pt& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
// remember that you need to take abs
long double area(point x, point y, point z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(point x, point y, point z)
{
	return area(x, y, z) > 0;
}
// remember that you need to take abs
long double area(pt x, pt y, pt z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(pt x, pt y, pt z)
{
	return area(x, y, z) > 0;
}
ll gcd(ll a, ll b)
{
	if (a > b)swap(a, b);
	if (a == 0)return b;
	return gcd(a, b % a);
}
int popcount(ll a)
{
	int count = 0;
	while (a)
	{
		count += (a & 1);
		a >>= 1;
	}
	return count;
}
ll choose(ll n, ll r)
{
	ll p = 1, k = 1;
	if (n - r < r)
		r = n - r;
	if (r != 0) {
		while (r) {
			p *= n;
			k *= r;
			long long m = gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else
		p = 1;
	return p;
}
vll prefix_hash(string& a, vll& powers, ll mod)
{
	int n = sz(a);
	vll prefix(n + 1);
	F0R(i, n)prefix[i + 1] = (prefix[i] + powers[i] * (a[i] - '1' + 1)) % mod;
	return prefix;
}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
struct custom_hash_fast {
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		x ^= FIXED_RANDOM;
		return x ^ (x >> 16);
	}
};
void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
	if (sz(s))
	{
		freopen((s + ".in").c_str(), "r", stdin);
		if (s != "test3")
			freopen((s + ".out").c_str(), "w", stdout);
	}
}
int main()
{
	setIO("");
	int n, m, q;
	cin >> n >> m >> q;
	vll a(n), b(m);
	F0R(i, n)cin >> a[i];
	trav(x, b)cin >> x;
	ll sum = 0;
	F0R(i, n)
	{
		if (i & 1)sum -= a[i];
		else sum += a[i];
	}
	ll curr = 0;
	vector<ll>val;
	F0R(i, n)
	{
		if (i & 1)curr -= b[i];
		else curr += b[i];
	}
	val.pb(curr);
	F0R(i, m - n)
	{
		curr -= b[i];
		curr = -curr;
		if (n & 1)
		{
			curr += b[i + n];
		}
		else
		{
			curr -= b[i + n];
		}
		val.pb(abs(curr));
	}
	sort(all(val));
	auto it = lower_bound(all(val), sum);
	ll ans = linf;
	if (it == val.end())
	{
		ans = min(ans, sum - val.back());
	}
	else
	{
		ans = min(ans, *it - sum);
		if (it != val.begin())
		{
			it--;
			ans = min(ans, sum - *it);
		}
	}
	cout << ans << endl;
	F0R(i, q)
	{
		ll a, b, c;
		cin >> a >> b >> c;
		if (b - a & 1)
		{
			//do nothing
		}
		else
		{
			sum += c;
		}
		auto it = lower_bound(all(val), sum);
		ll ans = linf;
		if (it == val.end())
		{
			ans = min(ans, sum - val.back());
		}
		else
		{
			ans = min(ans, *it - sum);
			if (it != val.begin())
			{
				it--;
				ans = min(ans, sum - *it);
			}
		}
		cout << ans << endl;
	}
}


/*
ID: awesome35
LANG: C++14
TASK: vans
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<chrono>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
// warning: ld is rougly 2x slower than double. Proof: ld: https://oj.uz/submission/319677 double: https://oj.uz/submission/319678
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define mp make_pair
#define rsz resize
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define f first
#define s second
//#define endl '\n'
#define test int testc;cin>>testc;while(testc--)
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; // for every grid problem!!
const ll linf = 4000000000000000000LL;
const ll inf = 1000000007;//998244353
const ld pi = 3.1415926535;

void pv(vi a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vll a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vector<vi>a) {
	F0R(i, sz(a)) { cout << i << endl; pv(a[i]); cout << endl; }
}void pv(vector<vll>a) { F0R(i, sz(a)) { cout << i << endl; pv(a[i]); }cout << endl; }void pv(vector<string>a) { trav(x, a)cout << x << endl; cout << endl; }
void build_primes(vi& primes, int size)
{
	vi visited;
	visited.rsz(size, 0);
	FOR(i, 2, size)
	{
		if (visited[i] == 0)
		{
			primes.pb(i);
			int a = i;
			while (a < size)
			{
				visited[a] = 1;
				a += i;
			}
		}
	}
}
vector<vector<ll>> matrix_mult(vector<vector<ll>>& a, vector<vector<ll>>& b)
{
	int n = a.size();
	vector<vector<ll>> answer;
	answer.resize(n);
	for (int i = 0; i < n; i++) answer[i].resize(n, 0);
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++) // calculate answer[i][j]
		{
			for (int k = 0; k < n; k++)
				answer[i][j] = (answer[i][j] + a[i][k] * b[k][j]) % inf;
		}
	}
	return answer;
}
int modInverse(int a, int m)
{
	int m0 = m;
	int y = 0, x = 1;
	if (m == 1)
		return 0;
	while (a > 1)
	{
		// q is quotient
		int q = a / m;
		int t = m;
		// m is remainder now, process same as
		// Euclid's algo
		m = a % m, a = t;
		t = y;
		// Update y and x
		y = x - q * y;
		x = t;
	}
	// Make x positive
	if (x < 0)
		x += m0;

	return x;
}
ll power(ll x, ll y)
{
	ll k = 1LL << 60;
	ll z = 1;
	while (k != 0)
	{
		z *= z;
		z %= inf;
		if (y >= k)
		{
			z *= x;
			z %= inf;
			y -= k;
		}
		k >>= 1;
	}
	return z;
}
struct point
{
	ld x, y;
	bool operator<(const point& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
struct pt
{
	ll x, y;
	bool operator<(const pt& rhs)const
	{
		if (x == rhs.x)return y < rhs.y;
		return x < rhs.x;
	}
};
// remember that you need to take abs
long double area(point x, point y, point z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(point x, point y, point z)
{
	return area(x, y, z) > 0;
}
// remember that you need to take abs
long double area(pt x, pt y, pt z)
{
	return (x.y * y.x + y.y * z.x + z.y * x.x - x.x * y.y - y.x * z.y - z.x * x.y) / 2.0;
}
bool clockwise(pt x, pt y, pt z)
{
	return area(x, y, z) > 0;
}
ll gcd(ll a, ll b)
{
	if (a > b)swap(a, b);
	if (a == 0)return b;
	return gcd(a, b % a);
}
int popcount(ll a)
{
	int count = 0;
	while (a)
	{
		count += (a & 1);
		a >>= 1;
	}
	return count;
}
ll choose(ll n, ll r)
{
	ll p = 1, k = 1;
	if (n - r < r)
		r = n - r;
	if (r != 0) {
		while (r) {
			p *= n;
			k *= r;
			long long m = gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else
		p = 1;
	return p;
}
vll prefix_hash(string& a, vll& powers, ll mod)
{
	int n = sz(a);
	vll prefix(n + 1);
	F0R(i, n)prefix[i + 1] = (prefix[i] + powers[i] * (a[i] - '1' + 1)) % mod;
	return prefix;
}
struct custom_hash {
	static uint64_t splitmix64(uint64_t x) {
		// http://xorshift.di.unimi.it/splitmix64.c
		x += 0x9e3779b97f4a7c15;
		x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
		x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
		return x ^ (x >> 31);
	}
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x + FIXED_RANDOM);
	}
};
struct custom_hash_fast {
	//the return type was size_t. But isnt that problematic?
	uint64_t operator()(uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
		x ^= FIXED_RANDOM;
		return x ^ (x >> 16);
	}
};
void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
	if (sz(s))
	{
		freopen((s + ".in").c_str(), "r", stdin);
		if (s != "test3")
			freopen((s + ".out").c_str(), "w", stdout);
	}
}
int main()
{
	setIO("");
	int n, m, q;
	cin >> n >> m >> q;
	vll a(n), b(m);
	F0R(i, n)cin >> a[i];
	trav(x, b)cin >> x;
	ll sum = 0;
	F0R(i, n)
	{
		if (i & 1)sum -= a[i];
		else sum += a[i];
	}
	ll curr = 0;
	vector<ll>val;
	F0R(i, n)
	{
		if (i & 1)curr -= b[i];
		else curr += b[i];
	}
	val.pb(curr);
	F0R(i, m - n)
	{
		curr -= b[i];
		curr = -curr;
		if (n & 1)
		{
			curr += b[i + n];
		}
		else
		{
			curr -= b[i + n];
		}
		val.pb(curr);
	}
	sort(all(val));
	auto it = lower_bound(all(val), sum);
	ll ans = linf;
	if (it == val.end())
	{
		ans = min(ans, sum - val.back());
	}
	else
	{
		ans = min(ans, *it - sum);
		if (it != val.begin())
		{
			it--;
			ans = min(ans, sum - *it);
		}
	}
	cout << ans << endl;
	F0R(i, q)
	{
		ll a, b, c;
		cin >> a >> b >> c;
		if (b - a & 1)
		{
			//do nothing
		}
		else
		{
			sum += c;
		}
		auto it = lower_bound(all(val), sum);
		ll ans = linf;
		if (it == val.end())
		{
			ans = min(ans, sum - val.back());
		}
		else
		{
			ans = min(ans, *it - sum);
			if (it != val.begin())
			{
				it--;
				ans = min(ans, sum - *it);
			}
		}
		cout << ans << endl;
	}
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxN = 1e5 + 13, INF = 1e18 + 13;
int n, m, q, a[maxN], b[maxN], suma;
vector<int> vec;

/*int cal () {
    auto pos = lower_bound(vec.begin(), vec.end(), suma);

    int rg = INF, lf = INF;
    if (pos != vec.end())
	int rg = pos - vec.begin();

    if (pos != vec.begin())
	int lf = (pos - 1) - vec.begin();
    return min (rg, lf);

    }*/

int cal () {
    int l = 0, r = m - n + 1;
    while (r - l > 1) {
	int mid = l + r >> 1;
	if (vec[mid] > suma) {
	    r = mid;
	}
	else
	    l = mid;
    }
    int lf = suma - vec[l], rg = (l != m - n) ? vec[l + 1] - suma : INF;
    return min(lf, rg);
}

int32_t main () {
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++) {
	cin >> a[i];
	if (i % 2 == 0) suma += a[i];
	else suma -= a[i];
    }

    for (int i = 0; i < m; i++)
	cin >> b[i];

    for (int i = 0; i <= m - n; i++) {
	int sumb = 0;
	for (int j = 0; j < n; j++) {
	    if (j % 2 == 0)
		sumb += b[i + j];
	    else
		sumb -= b[i + j];
	}
	vec.push_back(sumb);
    }

    sort(vec.begin(), vec.end());
    cout << abs(cal()) << '\n';

    while (q--) {
	int l, r, x;
	cin >> l >> r >> x;
	if ((r - l + 1) % 2 == 1) {
	    if (l % 2 == 1)
		suma += x;
	    else
		suma -= x;
	}
	cout << abs(cal()) << '\n';
    }

}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxN = 1e5 + 13, INF = 1e18 + 13;
int n, m, q, a[maxN], b[maxN], suma;
vector<int> vec;

/*int cal () {
    auto pos = lower_bound(vec.begin(), vec.end(), suma);

    int rg = INF, lf = INF;
    if (pos != vec.end())
	int rg = pos - vec.begin();

    if (pos != vec.begin())
	int lf = (pos - 1) - vec.begin();
    return min (rg, lf);

    }*/

int cal () {
    int l = 0, r = m - n + 1;
    while (r - l > 1) {
	int mid = l + r >> 1;
	if (vec[mid] > suma) {
	    r = mid;
	}
	else
	    l = mid;
    }
    int lf = suma - vec[l], rg = (l != m - n) ? vec[l + 1] - suma : INF;
    return min(lf, rg);
}

int32_t main () {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++) {
	cin >> a[i];
	if (i % 2 == 0) suma += a[i];
	else suma -= a[i];
    }

    for (int i = 0; i < m; i++)
	cin >> b[i];

    for (int i = 0; i <= m - n; i++) {
	int sumb = 0;
	for (int j = 0; j < n; j++) {
	    if (j % 2 == 0)
		sumb += b[i + j];
	    else
		sumb -= b[i + j];
	}
	vec.push_back(sumb);
    }

    sort(vec.begin(), vec.end());
    cout << abs(cal()) << '\n';

    while (q--) {
	int l, r, x;
	cin >> l >> r >> x;
	if ((r - l + 1) % 2 == 1) {
	    if (l % 2 == 1)
		suma += x;
	    else
		suma -= x;
	}
	cout << abs(cal()) << '\n';
    }

}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxN = 1e5 + 13, INF = 1e18 + 13;
int n, m, q, a[maxN], b[maxN], suma;
vector<int> vec;

/*int cal () {
    auto pos = lower_bound(vec.begin(), vec.end(), suma);

    int rg = INF, lf = INF;
    if (pos != vec.end())
	int rg = pos - vec.begin();

    if (pos != vec.begin())
	int lf = (pos - 1) - vec.begin();
    return min (rg, lf);

    }*/

int cal () {
    int l = 0, r = m - n + 1;
    while (r - l > 1) {
	int mid = l + r >> 1;
	if (vec[mid] > suma) {
	    r = mid;
	}
	else
	    l = mid;
    }
    int lf = suma - vec[l], rg = (l != m - n) ? vec[l + 1] - suma : INF;
    return min(lf, rg);
}

int32_t main () {
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++) {
	cin >> a[i];
	if (i % 2 == 0) suma += a[i];
	else suma -= a[i];
    }

    for (int i = 0; i < m; i++)
	cin >> b[i];

    for (int i = 0; i <= m - n; i++) {
	int sumb = 0;
	for (int j = 0; j < n; j++) {
	    if (j % 2 == 0)
		sumb += b[i + j];
	    else
		sumb -= b[i + j];
	}
	vec.push_back(sumb);
    }

    sort(vec.begin(), vec.end());
    cout << cal() << '\n';

    while (q--) {
	int l, r, x;
	cin >> l >> r >> x;
	if ((r - l + 1) % 2 == 1) {
	    if (l % 2 == 1)
		suma += x;
	    else
		suma -= x;
	}
	cout << cal() << '\n';
    }

}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxN = 1e5 + 13, INF = 1e18 + 13;
int n, m, q, a[maxN], b[maxN], suma;
vector<int> vec;

/*int cal () {
    auto pos = lower_bound(vec.begin(), vec.end(), suma);

    int rg = INF, lf = INF;
    if (pos != vec.end())
	int rg = pos - vec.begin();

    if (pos != vec.begin())
	int lf = (pos - 1) - vec.begin();
    return min (rg, lf);

    }*/

int cal () {
    int l = 0, r = m - n + 1;
    while (r - l > 1) {
	int mid = l + r >> 1;
	if (vec[mid] > suma) {
	    r = mid;
	}
	else
	    l = mid;
    }
    int lf = suma - vec[l], rg = (l != m - n) ? vec[l + 1] - suma : INF;
    return min(lf, rg);
}

int32_t main () {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++) {
	cin >> a[i];
	if (i % 2 == 0) suma += a[i];
	else suma -= a[i];
    }

    int sumb = 0;

    for (int i = 0; i < m; i++) {
	cin >> b[i];
	if (i < n) {
	    if (i % 2 == 0)
		sumb += b[i];
	    else
		sumb -= b[i];
	}
    }

    vec.push_back(sumb);
    for (int i = 1; i <= m - n; i++) {

	sumb -= b[i - 1];
	sumb *= -1;

	if (n % 2 == 1)
	    sumb += b[i + n - 1];
	else
	    sumb -= b[i + n - 1];

	vec.push_back(sumb);
    }

    sort(vec.begin(), vec.end());
    cout << abs(cal()) << '\n';

    while (q--) {
	int l, r, x;
	cin >> l >> r >> x;
	if ((r - l + 1) % 2 == 1) {
	    if (l % 2 == 1)
		suma += x;
	    else
		suma -= x;
	}
	cout << abs(cal()) << '\n';
    }

}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxN = 1e5 + 13, INF = 1e18 + 13;
int n, m, q, a[maxN], b[maxN], suma;
vector<int> vec;

int cal () {
    int l = 0, r = m - n + 1;
    while (r - l > 1) {
	int mid = l + r >> 1;
	if (vec[mid] > suma) {
	    r = mid;
	}
	else
	    l = mid;
    }
    int lf = suma - vec[l], rg = (l != m - n) ? vec[l + 1] - suma : INF;
    return min(lf, rg);
}

int32_t main () {
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++) {
	cin >> a[i];
	if (i % 2 == 0) suma += a[i];
	else suma -= a[i];
    }

    for (int i = 0; i < m; i++)
	cin >> b[i];

    for (int i = 0; i <= m - n; i++) {
	int sumb = 0;
	for (int j = 0; j < n; j++) {
	    if (j % 2 == 0)
		sumb += b[i + j];
	    else
		sumb -= b[i + j];
	}
	vec.push_back(sumb);
    }

    sort(vec.begin(), vec.end());
    cout << cal() << '\n';

    while (q--) {
	int l, r, x;
	cin >> l >> r >> x;
	if ((r - l + 1) % 2 == 1)
	    suma += x;
	cout << cal() << '\n';
    }

}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxN = 1e5 + 13, INF = 1e18 + 13;
int n, m, q, a[maxN], b[maxN], suma;
vector<int> vec;

/*int cal () {
    auto pos = lower_bound(vec.begin(), vec.end(), suma);

    int rg = INF, lf = INF;
    if (pos != vec.end())
	int rg = pos - vec.begin();

    if (pos != vec.begin())
	int lf = (pos - 1) - vec.begin();
    return min (rg, lf);

    }*/

int cal () {
    int l = 0, r = m - n + 1;
    while (r - l > 1) {
	int mid = l + r >> 1;
	if (vec[mid] > suma) {
	    r = mid;
	}
	else
	    l = mid;
    }
    int lf = suma - vec[l], rg = (l != m - n) ? vec[l + 1] - suma : INF;
    return min(lf, rg);
}

int32_t main () {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> m >> q;
    for (int i = 0; i < n; i++) {
	cin >> a[i];
	if (i % 2 == 0) suma += a[i];
	else suma -= a[i];
    }

    int sumb = 0;

    for (int i = 0; i < m; i++) {
	cin >> b[i];
	if (i < n) {
	    if (i % 2 == 0)
		sumb += b[i];
	    else
		sumb -= b[i];
	}
    }

    vec.push_back(sumb);
    for (int i = 1; i <= m - n; i++) {
	if (i % 2 == 1) {
	    sumb -= b[i - 1];
	    sumb *= -1;
	    if (n % 2 == 0)
		sumb -= b[i + n - 1];
	    else
		sumb += b[i + n - 1];
	}
	else {
	    sumb += b[i - 1];
	    sumb *= -1;
	    if (n % 2 == 0)
		sumb -= b[i + n - 1];
	    else
		sumb += b[i + n - 1];
	}
	vec.push_back(sumb);
    }

    sort(vec.begin(), vec.end());
    cout << abs(cal()) << '\n';

    while (q--) {
	int l, r, x;
	cin >> l >> r >> x;
	if ((r - l + 1) % 2 == 1) {
	    if (l % 2 == 1)
		suma += x;
	    else
		suma -= x;
	}
	cout << abs(cal()) << '\n';
    }

}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int64_t getmin(int64_t sum, vector<int64_t>& c) {
	int64_t p = lower_bound(c.begin(), c.end(), sum) - c.begin();
	return (min(sum - c[p - 1], c[p] - sum));
}
int main() {
	int64_t n, m, q;
	cin >> n >> m >> q;
	vector<int64_t> a(n);
	for (int64_t i = 0; i < n; ++i) cin >> a[i];
	vector<int64_t> b(m);
	for (int64_t i = 0; i < m; ++i) cin >> b[i];
	vector<int64_t> c;
	int64_t val0 = 0;
	for (int64_t i = 0; i < n; ++i) {
		if (i % 2 == 0) {
			val0 += b[i];
		}
		else val0 -= b[i];
	}
	int64_t prev = (n) % 2;//prev=1, если брать с -
	c.push_back(val0);
	for (int64_t i = 1; i < m - n + 1; ++i) {
		val0 = -val0;
		val0 += b[i - 1];
		if (prev) val0 += b[i + n - 1];
		else val0 -= b[i + n - 1];
		c.push_back(val0);
	}
	sort(c.begin(), c.end());
	c.push_back(1e17);
	vector<int64_t> d = { -100000000000000000 };
	for (auto elem : c) {
		d.push_back(elem);
	}
	c = d;
	int64_t a1 = 0;
	for (int64_t i = 0; i < n; ++i) {
		if (i % 2 == 0) a1 += a[i];
		else a1 -= a[i];
	}
	cout << getmin(a1, c) << "\n";
	while (q--) {
		int64_t l, r, x;
		cin >> l >> r >> x;
		if (l & 1) a1 += x;
		if ((r + 1) & 1) a1 -= x;
		cout << getmin(a1, c) << endl;
	}
	//for (auto elem : c) cout << elem << ' ';
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int64_t getmin(int64_t sum, vector<int64_t>& c) {
	int64_t p = lower_bound(c.begin(), c.end(), sum) - c.begin();
	return (min(sum - c[p - 1], c[p] - sum));
}
int main() {
	int64_t n, m, q;
	cin >> n >> m >> q;
	vector<int64_t> a(n);
	for (int64_t i = 0; i < n; ++i) cin >> a[i];
	vector<int64_t> b(m);
	for (int64_t i = 0; i < m; ++i) cin >> b[i];
	vector<int64_t> c;
	int64_t val0 = 0;
	for (int64_t i = 0; i < n; ++i) {
		if (i % 2 == 0) {
			val0 += b[i];
		}
		else val0 -= b[i];
	}
	int64_t prev = (n) % 2;//prev=1, если брать с -
	c.push_back(val0);
	for (int64_t i = 1; i < m - n + 1; ++i) {
		val0 = -val0;
		val0 += b[i - 1];
		if (prev) val0 += b[i + n - 1];
		else val0 -= b[i + n - 1];
		c.push_back(val0);
	}
	sort(c.begin(), c.end());
	c.push_back(1e9);
	vector<int64_t> d = { -1000000000 };
	for (auto elem : c) {
		d.push_back(elem);
	}
	c = d;
	int64_t a1 = 0;
	for (int64_t i = 0; i < n; ++i) {
		if (i % 2 == 0) a1 += a[i];
		else a1 -= a[i];
	}
	cout << getmin(a1, c) << "\n";
	while (q--) {
		int64_t l, r, x;
		cin >> l >> r >> x;
		if (l & 1) a1 += x;
		if ((r + 1) & 1) a1 -= x;
		cout << getmin(a1, c) << endl;
	}
	//for (auto elem : c) cout << elem << ' ';
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, q, a[N], b[N];
vector<long long> bsums;

long long query(long long x) {
	auto it = upper_bound(bsums.begin(), bsums.end(), x);
	auto prv = it;

	if (prv != bsums.begin()) {
		prv = prev(prv);
	}

	long long ans = abs(x - *prv);
	if (it != bsums.end()) {
		ans = min(ans, abs(x - *it));
	}

	return ans;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	cin >> n >> m >> q;

	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}

	for (int i = 1; i <= m; i++) {
		cin >> b[i];
	}

	long long sum = 0, sgn = 1;

	for (int i = 1; i <= n; i++) {
		sum += (long long) sgn * b[i];
		sgn = -sgn;
	}
	sgn = -sgn;

	bsums.emplace_back(sum);
	for (int i = n + 1; i <= m; i++) {
		sum -= (long long) b[i - n];
		sum = (long long) sgn * b[i] - sum;
		bsums.emplace_back(sum);
	}

	sort(bsums.begin(), bsums.end());

	sum = 0, sgn = 1;
	for (int i = 1; i <= n; i++) {
		sum += (long long) sgn * a[i];
		sgn = -sgn;
	}

	cout << query(sum) << '\n';

	int li, ri;
	long long xi;
	for (int qi = 0; qi < q; qi++) {
		cin >> li >> ri >> xi;
		if ((ri - li + 1) % 2) {
			if (li % 2) sum += xi;
			else sum -= xi;
		}

		cout << query(sum) << '\n';
	}

	return 0;
}


//Be Name Khoda
//no comment...
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using mordered_multiset =  tree<T, null_type, greater_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
const ll MOD = (int)1e9 + 7;
const ll MAXN = (ll)1e6 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
ll a[MAXN], b[MAXN], even[MAXN], odd[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, m, q;
	cin >> n >> m >> q;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < m; i++)
		cin >> b[i];
	ll sum = 0;
	for (int i = 0; i < n; i++)
		if(i % 2)
			sum -= a[i];
	else
		sum += a[i];

	vector<int> v;
	ll csum = 0;
	for (int i = 0; i < n; i++)
		if(i % 2 == 0)
			csum += b[i];
		else
			csum -= b[i];
	v.push_back(csum);
	for (int i = n; i < m; i++)
	{
		csum -= b[i - n];
		csum *= -1;
		if((n - 1) % 2 == 0)
			csum += b[i];
		else
			csum -= b[i];
		v.push_back(csum);
	}
	ll le = 0, re = v.size();
		while(re - le > 1)
		{
			ll mid = (le + re) >> 1;
			if(abs(sum - v[mid]) <= abs(sum - v[mid - 1]))
				le = mid;
			else
				re = mid;
		}
		cout << abs(sum - v[le]) << "\n";
	sort(v.begin(), v.end());
	for (int i = 0; i < q; i++)
	{
		int l, r, x;
		cin >> l >> r >> x;
		l--, r--;
		int odd = (r - l + 1) / 2, even = (r - l + 1) / 2;
		if((r - l + 1) % 2)
		{
			if(l % 2 == 0)
				even++;
			else
				odd++;
		}
		sum += (even - odd) * x;
		ll le = 0, re = v.size();
		while(re - le > 1)
		{
			ll mid = (le + re) >> 1;
			if(abs(sum - v[mid]) <= abs(sum - v[mid - 1]))
				le = mid;
			else
				re = mid;
		}
		cout << abs(sum - v[le]) << "\n";
	}
}


//Be Name Khoda
//no comment...
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using mordered_multiset =  tree<T, null_type, greater_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
const ll MOD = (int)1e9 + 7;
const ll MAXN = (ll)1e6 + 7;
const int infint = (int)1e9;
const ll inf = (ll)1e18;
ll a[MAXN], b[MAXN], even[MAXN], odd[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	ll n, m, q;
	cin >> n >> m >> q;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < m; i++)
		cin >> b[i];
	ll sum = 0;
	for (int i = 0; i < n; i++)
		if(i % 2)
			sum -= a[i];
	else
		sum += a[i];

	vector<ll> v;
	ll csum = 0;
	for (int i = 0; i < n; i++)
		if(i % 2 == 0)
			csum += b[i];
		else
			csum -= b[i];
	v.push_back(csum);
	for (int i = n; i < m; i++)
	{
		csum -= b[i - n];
		csum *= -1;
		if((n - 1) % 2 == 0)
			csum += b[i];
		else
			csum -= b[i];
		v.push_back(csum);
	}
	sort(v.begin(), v.end());
	ll le = -1, re = v.size();
		while(re - le > 1)
		{
			ll mid = (le + re) >> 1;
			if(abs(sum - v[mid]) <= abs(sum - v[mid - 1]))
				le = mid;
			else
				re = mid;
		}
		cout << abs(sum - v[le]) << "\n";
	for (int i = 0; i < q; i++)
	{
		ll l, r, x;
		cin >> l >> r >> x;
		l--, r--;
		ll odd = (r - l + 1) / 2, even = (r - l + 1) / 2;
		if((r - l + 1) % 2)
		{
			if(l % 2 == 0)
				even++;
			else
				odd++;
		}
		sum += (even - odd) * x;
		ll le = -1, re = v.size();
		while(re - le > 1)
		{
			ll mid = (le + re) >> 1;
			if(abs(sum - v[mid]) <= abs(sum - v[mid - 1]))
				le = mid;
			else
				re = mid;
		}
		cout << abs(sum - v[le]) << "\n";
	}
}