public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String s;
    int i, n, h, m, sum;
    char[] sch;


    for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String s;
    int i, n, h, m, sum;
    char[] sch;


    for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} Main public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String s;
    int i, n, h, m, sum;
    char[] sch;


    for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    }

    sc.close();
  } run {
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String s;
    int i, n, h, m, sum;
    char[] sch;


    for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    }

    sc.close();
  } java.util.Scanner sc = new java.util.Scanner(in); sc new java.util.Scanner(in) String s; s int i i n n h h m m sum; sum char[] sch; sch for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    } ; {
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    } {
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    } s = sc.next() s sc.next() sc.next sc if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      } "-".equals(s) "-".equals "-" s {
        break;
      } break; {
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      } m = sc.nextInt() m sc.nextInt() sc.nextInt sc n = s.length() n s.length() s.length s sch = new char[n] sch new char[n] n for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        } i = 0; i = 0 i 0 i < n i n i++ i++ i {
          sch[i] = s.charAt(i);
        } {
          sch[i] = s.charAt(i);
        } sch[i] = s.charAt(i) sch[i] sch i s.charAt(i) s.charAt s i sum = 0 sum 0 for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        } i = 0; i = 0 i 0 i < m i m i++ i++ i {
          h = sc.nextInt();
          sum += h;
        } {
          h = sc.nextInt();
          sum += h;
        } h = sc.nextInt() h sc.nextInt() sc.nextInt sc sum += h sum h for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        } i = 0; i = 0 i 0 i < n i n i++ i++ i {
          System.out.print(sch[(sum + i) % n]);
        } {
          System.out.print(sch[(sum + i) % n]);
        } System.out.print(sch[(sum + i) % n]) System.out.print System.out System System.out sch[(sum + i) % n] sch (sum + i) % n (sum + i) sum i n System.out.println() System.out.println System.out System System.out sc.close() sc.close sc java.io.InputStream in in java.io.PrintStream out out public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  } main {
    (new Main()).run(System.in, System.out);
  } (new Main()).run(System.in, System.out) (new Main()).run (new Main()) System.in System System.in System.out System System.out String[] args args public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String s;
    int i, n, h, m, sum;
    char[] sch;


    for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String s;
    int i, n, h, m, sum;
    char[] sch;


    for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
} Main
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    String s;
    int i, n, h, m, sum;
    char[] sch;


    for(;;){
      s = sc.next();
      if("-".equals(s)){
        break;
      }else{
        m = sc.nextInt();
        n = s.length();
        sch = new char[n];
        for(i = 0;i < n;i++){
          sch[i] = s.charAt(i);
        }

        sum = 0;
        for(i = 0;i < m;i++){
          h = sc.nextInt();
          sum += h;
        }

        for(i = 0;i < n;i++){
          System.out.print(sch[(sum + i) % n]);
        }
        System.out.println();
      }
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}