import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			String str;
			StringBuilder cards = new StringBuilder( 200+1 );
			int m, shuffle, len;
	        while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        }
			
			
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
} import java.io.*; io.* java class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			String str;
			StringBuilder cards = new StringBuilder( 200+1 );
			int m, shuffle, len;
	        while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        }
			
			
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
} Main public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			String str;
			StringBuilder cards = new StringBuilder( 200+1 );
			int m, shuffle, len;
	        while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        }
			
			
		} catch( IOException e ) {
			System.err.println( e );
		}
	} main {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			String str;
			StringBuilder cards = new StringBuilder( 200+1 );
			int m, shuffle, len;
	        while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        }
			
			
		} catch( IOException e ) {
			System.err.println( e );
		}
	} BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) ); kb new BufferedReader( new InputStreamReader( System.in ) ) try {
			String str;
			StringBuilder cards = new StringBuilder( 200+1 );
			int m, shuffle, len;
	        while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        }
			
			
		} catch( IOException e ) {
			System.err.println( e );
		} catch( IOException e ) {
			System.err.println( e );
		} IOException e {
			System.err.println( e );
		} System.err.println( e ) System.err.println System.err System System.err e {
			String str;
			StringBuilder cards = new StringBuilder( 200+1 );
			int m, shuffle, len;
	        while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        }
			
			
		} String str; str StringBuilder cards = new StringBuilder( 200+1 ); cards new StringBuilder( 200+1 ) int m m shuffle shuffle len; len while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        } null != ( str = kb.readLine() ) null ( str = kb.readLine() ) str kb.readLine() kb.readLine kb {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        } if( str.equals( "-" ) ) { break; } str.equals( "-" ) str.equals str "-" { break; } break; m = Integer.parseInt( kb.readLine() ) m Integer.parseInt( kb.readLine() ) Integer.parseInt Integer kb.readLine() kb.readLine kb len = str.length() len str.length() str.length str for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	} int i=0; int i=0; i 0 i<m i m i++ i++ i {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	} {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	} shuffle = Integer.parseInt( kb.readLine() ) shuffle Integer.parseInt( kb.readLine() ) Integer.parseInt Integer kb.readLine() kb.readLine kb cards.append( str.substring( shuffle, len ) ) cards.append cards str.substring( shuffle, len ) str.substring str shuffle len cards.append( str.substring( 0, shuffle ) ) cards.append cards str.substring( 0, shuffle ) str.substring str 0 shuffle str = cards.toString() str cards.toString() cards.toString cards cards.setLength( 0 ) cards.setLength cards 0 System.out.println( str ) System.out.println System.out System System.out str String[] args args
import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			String str;
			StringBuilder cards = new StringBuilder( 200+1 );
			int m, shuffle, len;
	        while( null != ( str = kb.readLine() ) ) {
	        	if( str.equals( "-" ) ) { break; }
	        	
	        	m = Integer.parseInt( kb.readLine() );
	        	len = str.length();
	        	for( int i=0; i<m; i++ ) {
	        		shuffle = Integer.parseInt( kb.readLine() );
	        		cards.append( str.substring( shuffle, len ) );
	        		cards.append( str.substring( 0, shuffle ) );
	        		str = cards.toString();
	        		cards.setLength( 0 );
	        	}
	        	System.out.println( str );
	        	
	        }
			
			
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
}